I just updated PAth Redirect and PAth Auto to the latest Dev versions (1st Dec) and got an error:

user warning: Unknown column 'path' in 'where clause' query: SELECT rid FROM path_redirect WHERE path = 'users/admin' LIMIT 0, 1 in xxxxxxxxxxxxxt\sites\all\modules\pathauto\pathauto.inc on line 74.

The culprit is that one of the fields in path_redirect has been changed and hence the code here needs updating. Specifically Line 74 currently reads as

$redirect_rid = db_result(db_query_range("SELECT rid FROM {path_redirect} WHERE path = '%s'", $alias, 0, 1));

and needs to be

$redirect_rid = db_result(db_query_range("SELECT rid FROM {path_redirect} WHERE source = '%s'", $alias, 0, 1));

Nick

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nickbits’s picture

I see there are other issues with the Dev release of Path_redirect suc as DSM's being left in. Above solution needs looking at with the path_redirect module in more detail.

Dave Reid’s picture

Assigned: Unassigned » Dave Reid
Status: Active » Postponed

There is a lot of heavy development and refactoring going on in path_redirect right now. That's why I created the recent beta5 release so everyone should be using that one. Once we are ready for a 1.0 release of path_redirect I'll post a patch with updated code.

nickbits’s picture

Dave,

No problem. I just wanted to test the dev versions and let you know about pos. issues.

Nick

Gerben Zaagsma’s picture

Same issue here, have Pathauto 6.x-1.2 installed and Path redirect beta 6.

Just to be sure: is this a problematic error or can it be left as is until the next update?

Gerben

Dave Reid’s picture

You should stay on beta 5 until we have a 1.0 release for path_redirect. That's when I'll be working with great to update the integration code.

hass’s picture

Does beta5 work well with pathauto? I remember a comment on the project home that we need to use DEV...

Dave Reid’s picture

Since pathauto released 1.2 recently, that's what I recommend people use (along with beta5 of path_redirect).

pearcec’s picture

subscribe

HongPong’s picture

subscribe -- If Beta6 isn't a good idea why did it get released?

Gerben Zaagsma’s picture

Downgrading caused so many new problems that I stick to beta6 for the moment.

leewbutler’s picture

Here's six steps I took to look into the issue. Anybody know if my fix in step 6 would jive with the rest of the code?

1. The error code breaks down like so....

user warning:
Unknown column 'path'
in 'where clause'
query: SELECT rid
FROM path_redirect
WHERE path = '[YOUR PAGE PATH]'
LIMIT 0, 1
in /[YOUR SERVER ROOT]/sites/all/modules/pathauto/pathauto.inc
on line 74.

2. And then a look at lines 73 & 74 in pathauto.inc shows this....

LINE 73: // If there still is this alias used in path_redirect, then create a different alias
LINE 74: $redirect_rid = db_result(db_query_range("SELECT rid FROM {path_redirect} WHERE path = '%s'", $alias, 0, 1));

3. A peak into path_redirect's PREVIOUS table VERSION 1.1.6.2 shows there was a 'path' column...

-- ----------------------------
-- Table structure for `path_redirect`
-- ----------------------------
DROP TABLE IF EXISTS `path_redirect`;
CREATE TABLE `path_redirect` (
`rid` int(11) NOT NULL auto_increment,
`path` varchar(255) NOT NULL,
`redirect` varchar(255) NOT NULL,
etc. etc....

4. While a peak into path_redirect's NEW table VERSION 1.1.6.4 shows 'path' has been changed to 'source'...

CREATE TABLE `path_redirect` (
`rid` int(11) NOT NULL auto_increment,
`source` varchar(255) NOT NULL,
`redirect` varchar(255) NOT NULL,
etc. etc....

5. So it looks like it has to do with this particular edit which was noted in VERSION 1.1.6.4 change notes....

Changes since DRUPAL-6--1-0-BETA5:
* #368377 by Dave Reid: Renamed {path_redirect}.path to {path_redirect}.source and backported changes from D7 branch.

6. Possible solution: could we just change line 74 in pathauto.inc to say "WHERE source" instead of "WHERE path"?
Since I'm not familiar with the rest of the modules code, I'm going to wait for someone else to chime in on this.

kmonty’s picture

subscribe

jurgenhaas’s picture

subscribe

00110000’s picture

My thoughts exactly. Why was it then released?

???

keereel’s picture

+1
subs

Tom Ash’s picture

Can you provide a fix for those of us who upgraded to beta6, since as people are saying there wasn't any indication we shouldn't do? (And Drupal complains if your modules are out of date!)

Starminder’s picture

Priority: Normal » Critical

subscribe, this one is ugly

splash112’s picture

Subscribe

Dave Reid’s picture

Status: Postponed » Needs review
FileSize
20.34 KB
1.33 KB
1.32 KB

Here's patches for both 6.x-1.x and 6.x-2.x branches as well as drop-in replacement files for pathauto.inc for the 6.x-1.x branch.

Dave Reid’s picture

Note the drop-in file is only for the 6.x-1.x branch.

Dave Reid’s picture

Corrected the 6.x-2.x patch.

greggles’s picture

Status: Needs review » Fixed

Now committed to 6.x-1.x http://drupal.org/cvs?commit=297286 and 6.x-2.x http://drupal.org/cvs?commit=297288

Everyone who complained in this issue, please help test out dev and beta releases before you upgrade your sites to be using them - Always start with a test site: http://drupal.org/creating-drupal-test-sites

greggles’s picture

p.s. Thanks Dave!

pearcec’s picture

Seriously. It is okay to post the issue, but the complaints about beta not working don't help. Thanks again.

Tom Ash’s picture

Much appreciated, and sorry if I came across as complaining, but there *is* an issue with Drupal strongly implying your should download the latest version at /admin/reports/updates so it's not people's fault if they got that impression..

greggles’s picture

@Thomas Ash - it is a problem. Have you created an issue in the queue to suggest improving that? Have you done work toward it?

pearcec’s picture

Status: Fixed » Needs work

Not sure how the change effects this. But when I add a new page that is automatically aliased, but uncheck it and put in my own path I get this:

user warning: Duplicate entry 'node-' for key 2 query: drupal_write_record /* admin : drupal_write_record */ INSERT INTO path_redirect (source, redirect, query, fragment, language, type, last_used) VALUES ('node', 'test-123-14', '', '', '', 301, 1259853145) in /home/pearcec/drupal/sites/cidde.pitt.edu/includes/common.inc on line 3468.

I think it is stemmed from this setting for pathauto.

My General Setting: Update Action is set to this:

* Create a new alias. Redirect from old alias.

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
637 bytes

@pearcec: I'll look into that, but it's a separate issue.

I forgot the section where pathauto creates the alias. Patch applies to both branches (6.x-1.x with some offset, but does apply).

pearcec’s picture

Status: Needs review » Needs work

Applied the patch

$ cat 647812-pathauto-pr-followup-D6.patch | patch
patching file pathauto.inc
Hunk #1 succeeded at 405 with fuzz 1 (offset -48 lines).

Still get the same error. My bet is that pathauto is trying to add a path_redirect for "the old" aliases but it is treating the first time aliases as the old one. We just need to skip doing this on the first request some how.

Dave Reid’s picture

Status: Needs work » Needs review

@pearcec: Please read what I had just posted. This new patch is unrelated to the issue you're reporting. It's probably because of the auto-redirect creation code creating the alias before pathauto does. Which is a new/separate issue.

pearcec’s picture

Oh thanks Dave, did you post it in the queue? Or would you like me too?

Tom Ash’s picture

@greggles - I'm not quite sure what I'd suggest/fix. A way to take betas out of suggestions (based just on searching for 'beta' in the version)? But would that really be a good thing?

greggles’s picture

Status: Needs review » Fixed

Committed - http://drupal.org/cvs?commit=297308 and 6.x-1.x http://drupal.org/cvs?commit=297310

Thanks again, Dave.

(@Thomas Ash - what I'm suggesting is that while there is a real problem if you haven't opened an issue about it then you are "just complaining" - the place to discuss the solution is in a new issue about the problem, not here)

mokko’s picture

to things short: applying path from #28 seems to work for me.

jaypabs’s picture

What patch should I apply? #19 then #21 and #28? Or should I only apply the patch on #28?

pydubreucq’s picture

Subscribing...

greggles’s picture

No need to apply patches, just download the latest Pathauto 6.x-1.x-dev and the patches are all included.

drahman’s picture

Component: Code » Documentation
Assigned: Dave Reid » Unassigned
Status: Fixed » Needs review

I understand that "complaining" is not what people want. So let me try to be constructive.

The problem I had was that every single page refresh of my site's admin section it was reminding me that my site was not secure and needed to be updated.("To ensure the security of your server, you should update immediately!"). There is a large red warning symbol and for people that are relatively new to Drupal, this can be scary. The Available Updates section tells me I need to update Path_Redirect. The download link provided takes me to a page that has no warning of the problems I am going to face if I have Path Auto.

My suggestion is to reword the warning in the Drupal admin section to make it clear the priority level of the update. Is it critical I run this update to Module X because of a security hole or is it merely a minor bug fix? As it stands now, for beginners it is very intimidating.

Yes, I know we are encouraged to have a testing site to run these updates on first. It just isn't feasible to expect everyone to have the resources of time and money to do that.

My two cents

PS My apologies to Dave Reid for this post being assigned to you. This is the first of second post I have made and didn't get those choices correct.

Dave Reid’s picture

@drahman: I am very confident that core's update status module does not go out of its way to warn about non-secure releases. On my own production site which is using update status, I haven't upgraded to beta6 yet. I don't get any kind of warning on any of my admin pages. It should only show up if there is an important security updated needed. Did you have more than path_redirect to update?

Dave Reid’s picture

This message that you got: "To ensure the security of your server, you should update immediately!" means the update immediately applied to only the security updates found. You didn't have to update path_redirect for your security. Only the one listed in red on the available updates page.

greggles’s picture

Component: Documentation » Code
Status: Needs review » Fixed

@drahman - please don't drag this issue off topic. There is no reason to change the documentation of Pathauto nor path redirect. If you want to change the wording in core, that's great, but Core just went to string freeze so you'll have to work on that in the Drupal 8 time frame. (and in the core issue queue, not here).

drahman’s picture

@greggles - Please accept my most sincere apologies. The issue I have is with the release notes page for Path Redirect.

hass’s picture

I haven't been able to test this yet, but if the change works, it would be great if you are able to release a new version that works together... it could at least stop the most users running into this issue.

Tom Ash’s picture

@greggles
@drahman

OK, I've created an issue as best I can!

http://drupal.org/node/651894

polesworth’s picture

Just a vague AOL on this one; any ETA on an updated release with the fix?

Thanks.

greggles’s picture

The dev is released and works fine. Looking at the usage statistics for Pathauto there are lots of people who haven't upgraded to 6.x-1.2 just yet. I don't want to jump too quickly on version numbers and plan to wait a bit for some other bug fixes in Pathauto first. Probably January some time I will make a new release.

polesworth’s picture

I've applied the patches for now; don't want to run a dev release, kinda defeats the point of the exercise.

Cheers.

drumnjo’s picture

subscribing

lizac’s picture

subscribing

pearcec’s picture

+1

greggles’s picture

Status: Fixed » Closed (fixed)

It seems that the bugs are fixed and no more useful comments are being added, so I'm moving the status to "closed" and closing comments.