Re: [HACKERS] ENUM type

2005-07-27 Thread Andrew Dunstan
Tom Lane wrote: "Jim C. Nasby" <[EMAIL PROTECTED]> writes: ... what I was wondering about is creating a 'type' that is a rollup for: - create parent table with int id field and text and indexes - add RI to base table - add triggers/views/rules/other glue to make the id field hid

Re: [HACKERS] ENUM type

2005-07-26 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > ... what I was wondering about is creating a > 'type' that is a rollup for: > - create parent table with int id field and text and indexes > - add RI to base table > - add triggers/views/rules/other glue to make the id field hidden and > transparent t

Re: [HACKERS] ENUM type

2005-07-26 Thread Andrew Dunstan
Jim C. Nasby wrote: On Wed, Jul 27, 2005 at 12:11:47AM +0200, Jochem van Dieten wrote: On 7/26/05, Jim C. Nasby wrote: On Tue, Jul 26, 2005 at 01:09:11PM -0700, Jeff Davis wrote: Ultimately to do it in a general way I think we'd need functions that return a type that can be u

Re: [HACKERS] ENUM type

2005-07-26 Thread Jim C. Nasby
On Wed, Jul 27, 2005 at 12:11:47AM +0200, Jochem van Dieten wrote: > On 7/26/05, Jim C. Nasby wrote: > > On Tue, Jul 26, 2005 at 01:09:11PM -0700, Jeff Davis wrote: > >> > >> Ultimately to do it in a general way I think we'd need functions that > >> return a type that can be used in a table definit

Re: [HACKERS] ENUM type

2005-07-26 Thread Jochem van Dieten
On 7/26/05, Jim C. Nasby wrote: > On Tue, Jul 26, 2005 at 01:09:11PM -0700, Jeff Davis wrote: >> >> Ultimately to do it in a general way I think we'd need functions that >> return a type that can be used in a table definition. Aside from the >> many problems I don't know about, there are two other

[HACKERS] ENUM type

2005-07-26 Thread Jim C. Nasby
On Tue, Jul 26, 2005 at 01:09:11PM -0700, Jeff Davis wrote: > Chris Travers wrote: > >> > > How hard would it be to automatically create enum_ tables in the back > > ground to emulate MySQL's enum type? Sort of like we do with SERIAL > > datatypes... Part of the problem is that MySQL's enum type

Re: [HACKERS] Enum type emulation: problem with opaque type in PL/pgSQL functions

2000-11-24 Thread Tom Lane
Max Fonin <[EMAIL PROTECTED]> writes: > Tom Lane <[EMAIL PROTECTED]> wrote: I guess the problem is that PL/pgSQL doesn't handle opaque type correctly. >> >> No it doesn't, which is not surprising considering that opaque isn't >> really a type at all. The error message could be improved thou

Re: [HACKERS] Enum type emulation: problem with opaque type in PL/pgSQL functions

2000-11-24 Thread Max Fonin
On Thu, 23 Nov 2000 11:13:28 -0500 Tom Lane <[EMAIL PROTECTED]> wrote: > Max Fonin <[EMAIL PROTECTED]> writes: > > I guess the problem is that PL/pgSQL doesn't handle opaque type correctly. > > No it doesn't, which is not surprising considering that opaque isn't > really a type at all. The erro

Re: [HACKERS] Enum type emulation: problem with opaque type in PL/pgSQL functions

2000-11-23 Thread Tom Lane
Max Fonin <[EMAIL PROTECTED]> writes: > I guess the problem is that PL/pgSQL doesn't handle opaque type correctly. No it doesn't, which is not surprising considering that opaque isn't really a type at all. The error message could be improved though :-( Currently I believe that the only way to w

[HACKERS] Enum type emulation: problem with opaque type in PL/pgSQL functions

2000-11-23 Thread Max Fonin
Guys, hello. Here is a problem. -- -- Creating 2 new functions and new type -- BEGIN; CREATE FUNCTION enum_week_in (opaque) RETURNS int2 AS ' DECLARE invalue ALIAS for $1; BEGIN IF invalue= OR invalue=''0'' THEN RETURN 0; END IF;