Hi,
Dave Page a écrit :
> Guillaume Lelarge wrote:
>> Here is a patch to support this new PostgreSQL 8.3 feature : the
>> possibility to add type modifier input and ouput functions to a newly
>> created type.
>
> Unfortunately this still needs some work. I found the following issues:
>
> - The typemod in/out functions are not included the reverse engineered
> SQL displayed on the main window when a type with such functions is
> selected (for reference, try pg_catalog.time).
>
Fixed.
> - I'm not so keen on the labelling. I would suggest:
>
> 'Typmod in function'/'Typmod out function' in the properties list.
> 'Typmod in func'/'Typmod out func' on dlgType.
>
Fixed too.
> - The code that loads the combo boxes in dlgType is broken. It's
> currently in loop designed to load the I/O and Send/Receive functions
> (which is somewhat broken in itself). The doc at
> http://www.postgresql.org/docs/8.3/static/sql-createtype.html describes
> the general signature of functions that are appropriate.
>
If I correctly understand what the code is doing, it selects all
functions that has a first argument but no second one, is this right ?
it does not check arguments' types.
In this case, I think we should change this SQL query
SELECT proname, nspname
FROM (
SELECT proname, nspname, max(proargtypes[0]) AS arg0,
max(proargtypes[1]) AS arg1
FROM pg_proc p
JOIN pg_namespace n ON n.oid=pronamespace
GROUP BY proname, nspname
HAVING count(proname) = 1 ) AS uniquefunc
WHERE arg0 <> 0 AND arg1 = 0
with this one
SELECT proname, nspname
FROM (
SELECT proname, nspname, max(proargtypes[0]) AS arg0,
max(proargtypes[1]) AS arg1
FROM pg_proc p
JOIN pg_namespace n ON n.oid=pronamespace
GROUP BY proname, nspname
HAVING count(proname) = 1 ) AS uniquefunc
WHERE arg0 <> 0 AND coalesce(arg1, 0) = 0
If I correctly read the CREATE TYPE manpage, I need to check that the
type_modifier_input_function function has one argument of type cstring[]
and returns an integer. And I need to check that the
type_modifier_output_function function has one integer argument and
returns a single ctring value. Is this right ?
If I'm right, all the code that get input, ouput, send and receive
functions is broken. Right ?
> [as a side note, the code here seems somewhat broken in general wrt the
> handling of the whole create function/create type chicken and egg
> scenario - I'll make a note to review that]
>
+1
Thanks.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com