Bret Hughes <bhughes@elevating.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