[SQL] Deferrable NOT NULL REFERENCES ... for two-way referential relationship

2008-03-25 Thread Craig Ringer
Hi all I'm running into an issue with my schema where I'm trying to establish a mandatory two-way relationship between two entities, and I'm hoping for some external wisdom. Using "customer" and "address" by way of example: CREATE TABLE customer ( id INTEGER PRIMARY KEY, address_id INTEGER NOT

Re: [SQL] Deferrable NOT NULL REFERENCES ... for two-way referential relationship (SOLVED?)

2008-03-25 Thread Craig Ringer
Craig Ringer wrote: Hi all I'm running into an issue with my schema where I'm trying to establish a mandatory two-way relationship between two entities, and I'm hoping for some external wisdom. Using "customer" and "address" by way of example: CREATE TABLE customer ( id INTEGER PRIMARY KEY, a

Re: [SQL] Deferrable NOT NULL REFERENCES ... for two-way referential relationship

2008-03-25 Thread Tom Lane
Craig Ringer <[EMAIL PROTECTED]> writes: > There are constraint triggers: > http://www.postgresql.org/docs/8.3/static/sql-createconstraint.html > and I could use one to enforce the NOT NULL on the table as a whole (at > an acceptable cost in this case). However, I've seen some posts like > this one

[SQL] copy command and array of composite types?

2008-03-25 Thread Jon Norman
I'm using PostgreSQL 8.3.1. I've created the following composite type: CREATE TYPE expression_event_type AS ( event_id varchar(10), expr_indices smallint[] ); which is used with the following table definition: CREATE TABLE boolean_expr_table( expr_id smallint PRIMARY KEY, expr_name varchar(100)

Re: [SQL] copy command and array of composite types?

2008-03-25 Thread Guy Fraser
Try to export some data from the table using "copy from ..." to see what it looks like. On 2008-Mar-25, at 12:19, Jon Norman wrote: I'm using PostgreSQL 8.3.1. I've created the following composite type: CREATE TYPE expression_event_type AS ( event_id varchar(10), expr_indices smallint[] )