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

Home » FUDforum Development » Bug Reports » PostgreSQL and attachments
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PostgreSQL and attachments [message #164124] Wed, 05 January 2011 13:00 Go to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
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 13:20 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
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 13:24 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
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 13:28 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
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 13:36 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
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 14:27 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
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 06:32 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
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 13:04 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
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 13:16 Go to previous messageGo to next message
mguillaume is currently offline  mguillaume   France
Messages: 13
Registered: December 2010
Karma: 0
Junior Member
Yep, that seems to work!
Re: PostgreSQL and attachments [message #164148 is a reply to message #164147] Thu, 06 January 2011 14:41 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Great! I'll commit it later.
  Switch to threaded view of this topic Create a new topic Submit Reply
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 Nov 30 19:22:33 GMT 2024

Total time taken to generate the page: 0.02818 seconds