I have this structure:

CREATE TABLE invoicelineitemtypes (
    invoicelineitemtypeid varchar(36) PRIMARY KEY,
    otherstuff varchar(36)
);

CREATE TABLE invoicelineiteminventorytypes (
    moresetuff varchar(36)
)
INHERITS (invoicelineitemtypes);

CREATE TABLE invoicelines (
invoicelineitemtypeid varchar(36) REFERENCES invoicelineitemtypes ON DELETE CASCADE,
    otherstuff varchar(36)
);

INSERT INTO invoicelineiteminventorytypes (invoicelineitemtypeid) VALUES ('1234');

The following insert:

INSERT INTO invoicelines (invoicelineitemtypeid) VALUES ('1234');

invokes

"insert or update on table "invoicelines" violates foreign key constraint "invoicelines_invoicelineitemtypeid_fkey"

Now, the rec with id '1234' is in the table invoicelineiteminventorytypes, but I can't wrap my head around the fact that

SELECT invoicelineitemtypeid FROM invoicelineitemtypes

yields the rec with invoicelineitemtypeid '1234', yet I can't reference it in the invoicelines INSERT statement.

Am I missing something? Is there a workaround for this?

PostgreSQL 8.0.1 running on OS X 10.4.2.



Garrett

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to