Re: CREATE TABLE with REFERENCE

From: Jonathan Bartlett <johnnyb(at)eskimo(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: "kay-uwe(dot)genz" <kug1977(at)web(dot)de>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: CREATE TABLE with REFERENCE
Date: 2003-07-28 19:30:11
Message-ID: Pine.GSU.4.44.0307281228260.8808-100000@eskimo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Why not just drop the "references" clause? I mean, the point of having
transactions is to guarantee integrity within a transaction, if you're not
going to have that, why even bother with the clause?

Most of my databases don't even user "references", just because I like the
flexibility, and I have multitable keys (keys that can refer to rows from
multiple tables).

Jon

On Mon, 28 Jul 2003, Dmitry Tkach wrote:

> kay-uwe.genz wrote:
>
> >Hi @ all,
> >
> >i've a little problem with two tables and FOREIGN KEYs. I've read about
> >this long time ago, but didn't remember me where. Well, I hope you can
> >help me.
> >
> >I've create two TABLEs "counties" and "cities". "Countries" have a row
> >"capital" is REFERENCEd "cities". "cities" have a row country
> >REFERENCEd "countries", where a save the country the city is placed.
> >
> >And now PG couldn't create the TABLEs, because the referenced table
> >doesn't exists in time of creation. Is there another method of creating
> >than the ALTER TABLE the first table after the second is living?
> >
> No. But what's wrong with ALTER TABLE?
>
> >
> >Second question. Is there a method of INSERT INTO both tables VALUES
> >without group them in the same Transaction?
> >
> >
> No (assuming, that you are talking about inserting a new country and a
> capital at the same time, and that the country's capital column cannot
> be null).
> But what's wrong with transactions?
>
> Dima
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave [Hawk-Systems] 2003-07-28 19:33:27 scoring select results
Previous Message fabricio 2003-07-28 19:12:41 translate referential integrity violation