Error when moving a category in postgresql 8.4.2

Please report bugs here!

Moderator: Thorsten

Post Reply
bram
Posts: 19
Joined: Mon Aug 16, 2010 12:54 pm

Error when moving a category in postgresql 8.4.2

Post by bram »

When postgresql 8.4.2 is used and a category is moved then there is an error:

Code: Select all

PHP warning:  pg_query() [<a href='function.pg-query'>function.pg-query</a>]:
Query failed: ERROR:  operator does not exist: character varying = integer LINE 1: ...E faqquestions SET ask_rubrik = 209373 WHERE ask_rubrik = 39                                                                    ^ HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts. in Pgsql.php on line 94
The query that fails:

Code: Select all

UPDATE faqquestions SET ask_rubrik = 223545 WHERE ask_rubrik = 47 message: operator does not exist: character varying = integer
The reason:

ask_rubrik is a varchar column and not an integer column.

In postgresql 8.2.* quotes around the integer are not needed when updating a varchar column (or an explicit cast from integer to varchar)
In postgresql 8.3.* I believe quotes around the integer are required when updating a varchar column (but I'm not 100% sure)
In postgresql 8.4.* quotes around the integer are needed when updating a varchar when updating a varchar column


There are several possible fixes:
a) always quote the integer => this may create problem elsewhere
b) change the ask_rubrik column to an integer (why is it a varchar?)
c) add extra queries to update faqquestions
d) ....?


In my opinion the best fix would be to update the ask_rubrik column to an integer but I do not know what the impact of this is.
In my phpMyFAQ installation I currently opted to repeat the queries for faqquestions with quotes but I do not see this as the best fix...
(a patch for 2.6.7 that does this is attached as reference)
You do not have the required permissions to view the files attached to this post.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error when moving a category in postgresql 8.4.2

Post by Thorsten »

Hi,

thanks for the patch! I reviewed it and added to phpMyFAQ 2.6.8.

The character column is an old relict from very old 1.x phpMyFAQ releases... I need to fix this.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply