On Mon, 28 Feb 2005, Richard Huxton wrote:
Oleg Bartunov wrote:
Hi there,
what's wrong to use SERIAL as FK without explicit PRIMARY KEY or UNIQUE ?
qq=# create table t1( id serial);
NOTICE: CREATE TABLE will create implicit sequence t1_id_seq for
serial column t1.id
CREATE TABLE
qq=# create
Oleg Bartunov wrote:
Hi there,
what's wrong to use SERIAL as FK without explicit PRIMARY KEY or UNIQUE ?
qq=# create table t1( id serial);
NOTICE: CREATE TABLE will create implicit sequence t1_id_seq for
serial column t1.id
CREATE TABLE
qq=# create table t2( id2 int4 references t1(id));
ERROR:
Hi there,
what's wrong to use SERIAL as FK without explicit PRIMARY KEY or UNIQUE ?
qq=# create table t1( id serial);
NOTICE: CREATE TABLE will create implicit sequence t1_id_seq for serial column
t1.id
CREATE TABLE
qq=# create table t2( id2 int4 references t1(id));
ERROR: there is no unique
On Mon, 28 Feb 2005, Oleg Bartunov wrote:
what's wrong to use SERIAL as FK without explicit PRIMARY KEY or UNIQUE ?
Serial isn't enough to guarantee uniqueness as required by foreign keys.
---(end of broadcast)---
TIP 8: explain analyze is your
On Mon, 28 Feb 2005, Stephan Szabo wrote:
On Mon, 28 Feb 2005, Oleg Bartunov wrote:
what's wrong to use SERIAL as FK without explicit PRIMARY KEY or UNIQUE ?
Serial isn't enough to guarantee uniqueness as required by foreign keys.
you're certainly right !
Regards,
Oleg