Re: Patch to add typmod's functions to a type's creation statement

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Patch to add typmod's functions to a type's creation statement
Date: 2007-12-03 18:53:48
Message-ID: 475450BC.4060208@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Guillaume Lelarge a écrit :
>> - 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, this patch does the job (ie, all previous patch's known
issues fixed).

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com

Attachment Content-Type Size
createtype_v2.patch text/x-patch 15.4 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message svn 2007-12-04 13:13:15 SVN Commit by dpage: r6867 - in trunk/pgadmin3: . pgadmin/debugger
Previous Message Guillaume Lelarge 2007-12-03 18:20:01 Re: Patch to add typmod's functions to a type's creation statement