Skip site navigation (1) Skip section navigation (2)

Re: plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND

From: Edmund Bacon <ebacon(at)onesystem(dot)com>
To: Marinos Yannikos <mjy(at)geizhals(dot)at>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND
Date: 2004-10-25 20:08:41
Message-ID: 417D5D49.1090908@onesystem.com (view raw or flat)
Thread:
Lists: pgsql-sql
Marinos Yannikos wrote:
> (btw.: I'm trying a few ways to ensure that all values in both t1 and t2 
> are unique:
> alter table blup add constraint check (blup_unique3(t1,t2));
>  - perhaps there are more elegant ways, any suggestions?)
>

No doubt someone will tell me this is Very Wrong:

create table blup_text(txt text primary key);

create table blup (t1 text references blup_text(txt),
                    t2 text references blup_text(txt));

You may want to add NOT NULL conditions to t1, t2.

If your text values are long, this may be a good place to use synthetic 
keys - e.g.

create table blup_text(id serial primary key, txt text unique);
create table blup(t1 integer references blup_text(id),
                   t2 integer references blub_text(id));



-- 
Edmund Bacon <ebacon(at)onesystem(dot)com>

In response to

pgsql-sql by date

Next:From: Adrian MaierDate: 2004-10-26 06:13:54
Subject: Re: [HACKERS] Question on the 8.0Beta Version
Previous:From: Tom LaneDate: 2004-10-25 20:02:27
Subject: Re: plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND variable?)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group