Re: REFERENCE problem with parent_table

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: gustavo halperin <ggh(dot)develop(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: REFERENCE problem with parent_table
Date: 2006-08-15 19:52:06
Message-ID: 20060815195206.20689.qmail@web31804.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > it looks like the syntax here is a little off from what is defined by:
> > http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
> >
> > CREATE TABLE like_id_1 ( id smallint like id_names,
> > name text like id_name ) with oids ;
> >
> Are you sure, I think that you are wrong. Operator "LIKE" is like a
> operator for a "table_constraint", I mean, is wrote in a new line, like
> a new column, and isn't property or part of any column. More over, in
> the documentation is wrote: "/The LIKE clause specifies a table from
> which the new table automatically copies all column names, their data
> types, and their not-null constraints./", but is like the operator
> "REFERENCE" see the tables "like_id_1" empty (see below) or maybe is a
> bug in posgresql.
> / database=# insert into like_id_1 values (1,'hello');
> INSERT 157581 1
> database=# select * from like_id_1;
> id | name
> ----+--------
> 1 | hello
> (1 row)
> database=# CREATE TABLE ref_1 ( id smallint CONSTRAINT the_id
> REFERENCES like_id_1 (id) );
> ERROR: there is no unique constraint matching given keys for
> referenced table "like_id_1"/

You are correct, I miss-spoke. :o)

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-08-15 19:54:50 Re:
Previous Message Stephan Szabo 2006-08-15 19:40:26 Re: REFERENCE problem with parent_table