Re: New Install: Attachment problem [message #40407 is a reply to message #40403] |
Tue, 26 February 2008 23:47 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
I am guessing PostgreSQL 8.3 removed the textcat function FUDforum uses for concatenation. The simplest solution would be to create an equivalent function yourself.
CREATE OR REPLACE FUNCTION extcatl(text, text)
RETURNS text AS 'SELECT $1 || $2;' LANGUAGE 'sql' VOLATILE;
FUDforum Core Developer
|
|
|
Re: New Install: Attachment problem [message #40415 is a reply to message #40407] |
Wed, 27 February 2008 16:46 |
derek
Messages: 21 Registered: May 2007
Karma: 0
|
Junior Member |
|
|
Ilia wrote on Tue, 26 February 2008 23:47 | I am guessing PostgreSQL 8.3 removed the textcat function FUDforum uses for concatenation. The simplest solution would be to create an equivalent function yourself.
CREATE OR REPLACE FUNCTION extcatl(text, text)
RETURNS text AS 'SELECT $1 || $2;' LANGUAGE 'sql' VOLATILE;
|
Ilia, thanks I tried this but got the same error. I also created the function as 'textcat' (as opposed to 'extcatl') in case this was a typo, but still no joy.
Interestingly (maybe) at first I thought it had worked: if replying to a message, attaching a file gives no error but the file is not attached. When creating a topic and attaching a file to the post, the error message is still there. I don't know if this was the case before I created the above functions.
I thought it might be to do with the database owner: all the tables/functions have the owner as 'postgres' but I created the ones above as 'webmaster'. I re-did them as postgres but this did not help.
Interestingly (again maybe) I dropped the 'extcatl' function with no problem, but when I tried to drop 'textcat' I got the message
NOTICE: removing built-in function "textcat"
ERROR: cannot drop function textcat(text,text) because it is required by the database system
which makes me think that textcat was already there. I think I confirmed this by dropping the 'or replace' part of the sql and getting this error message:
psql:textcat3.sql:6: ERROR: function "textcat" already exists with same argument types
So back to the drawing board on this one I'm afraid... any other ideas on how to resolve this?
Thanks,
Derek
|
|
|
|
Re: New Install: Attachment problem [message #40429 is a reply to message #40421] |
Thu, 28 February 2008 07:07 |
derek
Messages: 21 Registered: May 2007
Karma: 0
|
Junior Member |
|
|
How could I tell if permissions were different for this function compared to all the others?
Here are the details of textcat:
Schema | Name | Result data type | Argument data types | Volatility | Owner | Language | Source code | Description
------------+---------+------------------+---------------------+------------+----------+----------+-------------+-------------
pg_catalog | textcat | text | text, text | immutable | postgres | internal | textcat | concatenate
and here are the details of one of the other functions:
Schema | Name | Result data type | Argument data types | Volatility | Owner | Language | Source code | Description
------------+------------+------------------+---------------------+------------+----------+----------+----------------------------------+-------------
pg_catalog | textanycat | text | text, anynonarray | immutable | postgres | sql | select $1 || $2::pg_catalog.text | concatenate
The Language & Source code look (significantly?) different, any clues there?
Thanks
[Updated on: Thu, 28 February 2008 08:03] Report message to a moderator
|
|
|
|
Re: New Install: Attachment problem [message #40435 is a reply to message #40431] |
Fri, 29 February 2008 01:24 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Oh I see...
You need to edit ppost.php.t and attach.inc.t
and change:
$cc = __FUD_SQL_CONCAT__.'('.__FUD_SQL_CONCAT__."('".$FILE_STORE."', id), '.atch')";
to
$cc = __FUD_SQL_CONCAT__.'('.__FUD_SQL_CONCAT__."('".$FILE_STORE."', id::text), '.atch')";
FUDforum Core Developer
|
|
|
|
Bug related to file attachments when using FUDforum with PostgreSQL [message #158116] |
Mon, 02 February 2009 09:44 |
|
There is a bug that seems to have slipped below the radar since February 2008. I know there hasn't been any release since that date, but the 2.8.0RC1 doesn't include the patch (I just checked).
So please, naudefj as you have CVS write access now, could you add the patch?
The thread about this bug is here: http://fudforum.org/forum/index.php?t=msg&th=9928&start=0&
To correct it, just edit the ppost.php.t and attach.inc.t files, changing:
$cc = __FUD_SQL_CONCAT__.'('.__FUD_SQL_CONCAT__."('".$FILE_STORE."', id), '.atch')";
to
$cc = __FUD_SQL_CONCAT__.'('.__FUD_SQL_CONCAT__."('".$FILE_STORE."', id::text), '.atch')";
Without this, users can't add attachments (applies to PostgreSQL installations only).
|
|
|
|
Re: FUDforum 2.8.0RC1 Released [message #158122 is a reply to message #158121] |
Mon, 02 February 2009 14:16 |
|
naudefj wrote on Mon, 02 February 2009 14:11 | Hi Luc,
What does the "::text" part do? It looks like a typecast. Will this patch break MySQL or SQLlite support?
|
That's because PostgreSQL, when receiving a call from this function, get in id an integer, but the function in PostgreSQL has a signature "text,text", so it doesn't find a "text,integer" signature, and thus doesn't recognize that function.
So here, we force the definition of "text" so that the signature is correct.
As of knowing if that breaks anything if someone is using MySQL or sqlite, I really have no idea, sorry
|
|
|
|
|
|
|