X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E159CD1D08C for ; Sun, 11 Apr 2004 23:27:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06184-05 for ; Sun, 11 Apr 2004 23:27:41 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 97532D1BB89 for ; Sun, 11 Apr 2004 23:27:26 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i3C2RLRt028213; Sun, 11 Apr 2004 22:27:21 -0400 (EDT) To: Bret Hughes Cc: Stephan Szabo , postgresql sql list Subject: Re: trigger/for key help In-reply-to: <1081724318.2628.20.camel@bretsony> References: <1081662204.6609.72.camel@bretsony> <20040411080932.Q83278@megazone.bigpanda.com> <1081711155.6399.165.camel@bretsony> <17189.1081720813@sss.pgh.pa.us> <1081724318.2628.20.camel@bretsony> Comments: In-reply-to Bret Hughes message dated "11 Apr 2004 17:58:37 -0500" Date: Sun, 11 Apr 2004 22:27:21 -0400 Message-ID: <28212.1081736841@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/112 X-Sequence-Number: 17487 Bret Hughes 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