[SQL] UNIQUE constraint

2004-08-08 Thread Sascha Ziemann
Hi, I have a question about the UNIQUE constraint. The documentation describes this example: CREATE TABLE example ( a integer, b integer, c integer, UNIQUE (a, c) ); But it is not clean to me. Does the above example mean that the list of pairs must be unique or is it only a

[SQL] select

2004-08-08 Thread Knut P Lehre
I have a table with fields: id A B C D E F where id is an int4 primary key. In this table there is information like: 1 a1 b1 xxx xxx 2 a1 b1 xxx xxx xxx xxx 3 a2 b2 xxx

Re: [SQL] Make a column case insensitive

2004-08-08 Thread Thomas Wegner
I create every time i need this, a copy of this field filled out by a trigger on insert and update that holds the upper (or lower for you) value of the orginal field like this: create table users ( email varchar(255), ... u_email varchar(255) ... ); CREATE OR REPLACE FUNCTION

Re: [SQL] UNIQUE constraint

2004-08-08 Thread Michael Glaesemann
On Aug 7, 2004, at 3:25 AM, Sascha Ziemann wrote: CREATE TABLE example ( a integer, b integer, c integer, UNIQUE (a, c) ); But it is not clean to me. Does the above example mean that the list of pairs must be unique Yes. Does the following table fullfill the UNIQUE clause of the

Re: [SQL] surrogate key or not?

2004-08-08 Thread Josh Berkus
Kenneth, but why would anyone want to change the value of an autogenerated serial row? But if you're using a real key, it may need to change. The only reason *not* do do it that way is performance issues with CASCADE. -- -Josh Berkus Aglio Database Solutions San Francisco