Re: trigger/for key help

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bret Hughes <bhughes(at)elevating(dot)com>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, postgresql sql list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: trigger/for key help
Date: 2004-04-12 02:27:21
Message-ID: 28212.1081736841@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Bret Hughes <bhughes(at)elevating(dot)com> writes:
> FWIW I tried to use alter table but could never get the parser to accept
> $1 as a constraint name. I used single and double quotes as well as a
> lame attempt \$1.

Hm, "$1" works for me ...

regression=# create table foo (f1 int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
CREATE TABLE
regression=# create table bar (f1 int references foo);
CREATE TABLE
regression=# \d bar
Table "public.bar"
Column | Type | Modifiers
--------+---------+-----------
f1 | integer |
Foreign-key constraints:
"$1" FOREIGN KEY (f1) REFERENCES foo(f1)

regression=# alter table bar drop constraint "$1";
ALTER TABLE
regression=#

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bret Hughes 2004-04-12 07:18:35 Re: trigger/for key help
Previous Message Bret Hughes 2004-04-11 22:58:37 Re: trigger/for key help