|
|
 | | From: | KÖPFERL_Robert | | Subject: | RE RE: Single row tables | | Date: | Thu, 13 Jan 2005 12:39:46 +0100 |
|
|
 | The first seems like an appropriate solution. Fireing a trigger-function that returns null. If I however try to implement a function getnull in sql I fail. Defining the trigger requests a function of type trigger while definition of a function forbids using trigger as return type. So RTFM - there's however just an example for C. I don't want to engage the compiler.... :-/
> -----Original Message----- > From: sad [mailto:sad@bankir.ru] > Sent: Mittwoch, 12. Jänner 2005 07:40 > To: KÖPFERL Robert > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] Single row tables > > > On Tuesday 11 January 2005 17:45, KÖPFERL Robert wrote: > > Hi, > > > > with what constraint or how can I ensure that one of my > tables has exact > > one record or 0..1 records? > > A trigger procedure BEFORE INSERT would help you. > > And a column type with only one possible field value would > help you if you > define UNIQUE INDEX on a field of this (user-defined) type. >
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org
|
|
|