FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » PostgreSQL and attachments
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
PostgreSQL and attachments [message #164124] Wed, 05 January 2011 08:00 Go to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
When attaching a file to a post, the following request is generated for PostgreSQL:
UPDATE fud30_attach SET location='/opt/forum/data/files/'||id||'.atch', message_id=13754 WHERE id IN(6) AND attach_opt=0
This triggers an error as apparently is doesn't like double-concatenations with different types.

I think a possible fix would be, in attach.inc.t line 59 and ppost.inc.t line 304:
$cc = q_concat(_esc($GLOBALS['FILE_STORE']), 'cast(id as text)', _esc('.atch'));
Re: PostgreSQL and attachments [message #164125 is a reply to message #164124] Wed, 05 January 2011 08:20 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
I've just tested against pgsql 8.4.0 (not the PDO driver), but cannot replicate the problem.
Re: PostgreSQL and attachments [message #164126 is a reply to message #164125] Wed, 05 January 2011 08:24 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I can reproduce it directly in psql with the generated SQL.
The error I'm getting is "Could not choose a best candidate operator. You might need to add explicit type casts." (postgresql 8.4.3)
Re: PostgreSQL and attachments [message #164127 is a reply to message #164126] Wed, 05 January 2011 08:28 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Strange, executing the statement directly works without any errors on my system.
Re: PostgreSQL and attachments [message #164129 is a reply to message #164127] Wed, 05 January 2011 08:36 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I also get "ERROR: operator is not unique: unknown || integer"
I guess depending on the version the literal strings aren't always implicitly text.
Re: PostgreSQL and attachments [message #164130 is a reply to message #164129] Wed, 05 January 2011 09:27 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Here is a proposed patch.
http://sourceforge.net/apps/trac/fudforum/changeset/5098

PS: I cannot test it, you must please help me here.
Re: PostgreSQL and attachments [message #164140 is a reply to message #164130] Thu, 06 January 2011 01:32 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I don't think that would work as 'id' is not numerical on the php side (it's the fud30_attach index column name).
Re: PostgreSQL and attachments [message #164146 is a reply to message #164140] Thu, 06 January 2011 08:04 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
OK, let's try again. How about changing:
return implode('||', $tmp);
to
return implode('::text ||', $tmp);

Re: PostgreSQL and attachments [message #164147 is a reply to message #164146] Thu, 06 January 2011 08:16 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Yep, that seems to work!
Re: PostgreSQL and attachments [message #164148 is a reply to message #164147] Thu, 06 January 2011 09:41 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Great! I'll commit it later.
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: text error on Mailing List Manager
Next Topic: Backslashes after editing file
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Dec 16 21:13:22 EST 2017

Total time taken to generate the page: 0.00863 seconds