Upgrading the Views module to version 6.x-2.3 for Drupal using a PostgreSQL database gave the following warnings:
warning: pg_query() [function.pg-query]: Query failed: ERROR: column "data" is of type text but expression is of type bytea HINT: You will need to rewrite or cast the expression. in D:\Project\krw-portaal\includes\database.pgsql.inc on line 139.
user warning: query: UPDATE views_object_cache SET data = data_old in D:\Project\krw-portaal\includes\database.pgsql.inc on line 915.
views module
Update #6002
ALTER TABLE {views_object_cache} RENAME data TO data_old
ALTER TABLE {views_object_cache} ADD COLUMN data text
Failed: UPDATE {views_object_cache} SET data = data_old
ALTER TABLE {views_object_cache} DROP COLUMN data_old
Comment | File | Size | Author |
---|---|---|---|
#23 | 373225-d6-port_2.patch | 1.39 KB | Josh Waihi |
#18 | 373225-d6-port_1.patch | 1.13 KB | Josh Waihi |
#15 | 373225-d7-port.patch | 1.45 KB | Josh Waihi |
#11 | 373225-d7-port.patch | 903 bytes | Josh Waihi |
#3 | 373225-d6-postgres-fix.patch | 878 bytes | Josh Waihi |
Comments
Comment #1
Josh Waihi CreditAttribution: Josh Waihi commentedsubscribing to this. Query needs to be something like UPDATE {views_object_cache} SET data = CAST(data_old AS TEXT)
Comment #2
Josh Waihi CreditAttribution: Josh Waihi commentedComment #3
Josh Waihi CreditAttribution: Josh Waihi commentedI've tested and confirmed that this patch fixes the issue above. However this is a Core issue and not a view issue.
Comment #4
sammys CreditAttribution: sammys commentedThere is a duplicate issue post over at http://drupal.org/node/370957
Comment #5
sriddering CreditAttribution: sriddering commentedI'm glad that you have found the problem and fixed it for future generations,, but exactly how would someone fix the error if they run into it now and it is causing their site to malfunction?
Comment #6
brianV CreditAttribution: brianV commented@sriddering,
Open includes/database.pgsql.inc, and find this around line 915:
$ret[] = update_sql("UPDATE {". $table ."} SET $field_new = ". $field ."_old");
and replace it with:
Make sure you back up the file before editing just in case you make a mistake and break your site.
Comment #7
Josh Waihi CreditAttribution: Josh Waihi commented@sriddering: untill this patch gets commited, people that use db_change_column (i think thats what its called) in such a way will lose the old data unfortunately since this isn't done in a transaction. no way to get it back :( fortunately for this context, the data isn't that important and views will still be ok nevertheless
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedSince this breaks the 2.2 to 2.3 upgrade for pgsql users I'm upping this to critical.
Comment #9
Josh Waihi CreditAttribution: Josh Waihi commented@merlinofchaos: that may explain the lack of interest :D
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedIt may be that we need to have ti fixed for D7 and then backported, except I have no idea how different db_change_column even is in D7.
Comment #11
Josh Waihi CreditAttribution: Josh Waihi commentedComment #12
merlinofchaos CreditAttribution: merlinofchaos commentedComment #13
Josh Waihi CreditAttribution: Josh Waihi commentedhmm, this maybe problematic for situations, for example, converting INT to CHAR:
however it is how PostgreSQL deals with such a situation. I'm sure we can be any more accurate without a whole bunch of logic that says IF casting from type x to type y do this ELSE IF and so on.
Comment #14
webchickJosh informed me that he hasn't run the pgsql tests to make sure this doesn't break them. Marking this down to code needs review until that happens.
Comment #15
Josh Waihi CreditAttribution: Josh Waihi commentedComment #16
Josh Waihi CreditAttribution: Josh Waihi commentedbetter. fixed stuff. message I wrote did post before :(
Comment #17
webchickOk, committed to HEAD. Needs porting to 6.x.
Comment #18
Josh Waihi CreditAttribution: Josh Waihi commentedComment #19
Josh Waihi CreditAttribution: Josh Waihi commentedsomethings up with commenting and posting patches at the same time :(
Comment #20
Gábor HojtsyLet's not loose the code comment in Drupal 6!
Comment #21
Josh Waihi CreditAttribution: Josh Waihi commented@Gabor Hojtsy you mean you want comments to describe whats happening?
Comment #22
Gábor HojtsyWhy is the code comment in the Drupal 7 patch would not be applicable to Drupal 6? How can you make be applicable?
Comment #23
Josh Waihi CreditAttribution: Josh Waihi commented+comments
Comment #24
Josh Waihi CreditAttribution: Josh Waihi commentedComment #25
Gábor HojtsyFixed code style according to D6 standards (whitespace around concatenation), and committed this one: http://drupal.org/cvs?commit=222930 Thanks!