pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Edmund Bacon <ebacon@onesystem.com>
To: Marinos Yannikos <mjy@geizhals.at>
Cc: pgsql-sql@postgresql.org
Subject: Re: plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND
Date: Mon, 25 Oct 2004 14:08:41 -0600
Message-ID: <417D5D49.1090908@onesystem.com> (raw)
In-Reply-To: <417D57B1.8010507@geizhals.at>
References: <417D57B1.8010507@geizhals.at>

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@onesystem.com>



view thread (3+ messages)

Message-ID: <417D5D49.1090908@onesystem.com>
Permalink:  ../417D5D49.1090908@onesystem.com/
Also on:    postgresql.org/message-id/417D5D49.1090908@onesystem.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ebacon@onesystem.com, mjy@geizhals.at
  Subject: Re: plpgsql: PERFORM vs. SELECT INTO (PERFORM not setting FOUND
  In-Reply-To: <417D5D49.1090908@onesystem.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox