SMF Support > PostgreSQL and SQLite Support
Problem with Membergroups & Permissions
ChaosX128:
Ok so I decided to do a fresh install in a test directory just to see if this a bug using PostgreSQL.
One "find_in_set" function is "text, text" and the other is "integer, text"
Is that supposed to be the same as character varying?
emanuele:
The two find_in_set should be used by postgre depending on the type of data sent (integers or text).
Oldiesmann:
Did some more testing with this.
The error is due to PostgreSQL's habit of being extremely picky with data types...
The first parameter is a "smallint", but we don't have a function to explicitly handle a parameter of that type. PostgreSQL can automatically handle conversion from "smallint" to "integer" and from "smallint" to "text". The problem here is that PostgreSQL doesn't know which function to use.
The simple solution is to just add yet another find_in_set function which explicitly handles smallint:
--- Code: ---CREATE OR REPLACE FUNCTION FIND_IN_SET(needle smallint, haystack text) RETURNS integer AS '
SELECT i AS result
FROM generate_series(1, array_upper(string_to_array($2,'',''), 1)) AS g(i)
WHERE (string_to_array($2,'',''))[i] = CAST($1 AS text)
UNION ALL
SELECT 0
LIMIT 1'
LANGUAGE 'sql';
--- End code ---
That will fix the issue. I'll commit the change in a bit.
emanuele:
For the record: committed (ff3655588dc23fe5cfd2bb2ab8735b1d11a30d88).
Navigation
[0] Message Index
[*] Previous page
Go to full version