Re: Named constraints

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Francisco Reyes <lists(at)natserv(dot)com>
Cc: pgsql General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Named constraints
Date: 2002-05-23 03:29:18
Message-ID: 20020522202821.S62000-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 22 May 2002, Francisco Reyes wrote:

> I am trying to create a named constraint, but it doesn't seem to take the
> name.
>
> I got an example from the referential integrity page
> http://techdocs.postgresql.org/techdocs/hackingreferentialintegrity.php
>
> After looking the examples I created SQL script
>
> create table Users
> (
> UserID serial primary key,
> GroupID integer
> constraint fkgroup
> references Groups,
> LocationID integer
> constraint fklocations
> references Locations,
> Password varchar(20) NOT NULL,
> Name varchar(16) NOT NULL,
> LongName varchar(20) NOT NULL,
> Email varchar(50)
> );
>
> It creates the table, but lists the triggers
> Triggers: RI_ConstraintTrigger_13682386,
> RI_ConstraintTrigger_13682392
>
> Is there a different syntax I should be using?

Nope, that's right, it's just that the trigger
names aren't the same as the constraint name.
If you violate the constraint it should use the
given names, and when drop constraint works with
fk constraints it'll use them as well.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2002-05-23 03:41:11 Re: Named constraints
Previous Message Francisco Reyes 2002-05-23 03:03:18 Named constraints