Re: trigger/for key help - Mailing list pgsql-sql

From Greg Stark
Subject Re: trigger/for key help
Date
Msg-id 873c78e6wf.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: trigger/for key help  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: trigger/for key help  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane <tgl@sss.pgh.pa.us> writes:

> 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 ...

Hm, this reminds me. When I was first learning this stuff I was stymied by the
same issue. It took me quite a while to figure out how to drop constraints
because of the quoting issue.

Of course now it seems obvious, but for someone just starting it adds another
roadblock. Is there a reason postgres goes out of its way to pick names that
will be harder to work with than necessary?

Or is it considered a good thing on the theory that if it's hard to reference
it's also hard to accidentally use such names in conflicting ways?

Perhaps names like _1 _2 ... would be easier to handle? 
Or perhaps making $ not require quoting would be helpful?

-- 
greg



pgsql-sql by date:

Previous
From: Bret Hughes
Date:
Subject: Re: trigger/for key help
Next
From: Richard Huxton
Date:
Subject: Re: cursors and for loops?