Thread: Re: Newbie Constraint ?

Re: Newbie Constraint ?

From
"Jeanna Geier"
Date:
 Hello List!

 OK, so I'm new to SQL and Postgres and am working on taking over this DB
work, and ran across a command that I'm not sure of and am wondering if you
can help me with... Probably a basic SQL question, but thought more than one
person on here would be able to point me in the right direction!!

 In on of the tables in the DB, there is a constraint defined that I'm not
familiar with:

   CONSTRAINT "Relationship182" FOREIGN KEY (elementid)
      REFERENCES element (elementid) MATCH SIMPLE
      ON UPDATE CASCADE ON DELETE CASCADE


 Not quite sure what the: CONSTRAINT "Relationship182" is exactly...  can
anyone help me with this one?  Haven't seen this one yet...


 Thanks much for your help and support!
 -Jeanna


Re: Newbie Constraint ?

From
Bricklen Anderson
Date:
Jeanna Geier wrote:
>  Hello List!
>
>  OK, so I'm new to SQL and Postgres and am working on taking over this DB
> work, and ran across a command that I'm not sure of and am wondering if you
> can help me with... Probably a basic SQL question, but thought more than one
> person on here would be able to point me in the right direction!!
>
>  In on of the tables in the DB, there is a constraint defined that I'm not
> familiar with:
>
>    CONSTRAINT "Relationship182" FOREIGN KEY (elementid)
>       REFERENCES element (elementid) MATCH SIMPLE
>       ON UPDATE CASCADE ON DELETE CASCADE
>
>
>  Not quite sure what the: CONSTRAINT "Relationship182" is exactly...  can
> anyone help me with this one?  Haven't seen this one yet...
>
That's the constraint name.
More detailed here:
http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html

Re: Newbie Constraint ?

From
Bruno Wolff III
Date:
On Mon, Jan 08, 2007 at 14:55:29 -0600,
  Jeanna Geier <jgeier@apt-cafm.com> wrote:
>
>  Not quite sure what the: CONSTRAINT "Relationship182" is exactly...  can
> anyone help me with this one?  Haven't seen this one yet...

It is the name of that particular constraint. You would use that if you
were going to delete the constraint. If it hadn't been explicitly named,
it would have gotten a default name.