From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Scott Bailey <artacus(at)comcast(dot)net> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Naming functions with reserved words |
Date: | 2009-06-17 14:42:16 |
Message-ID: | 20090617144216.GL860@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jun 17, 2009 at 01:46:13AM -0700, Scott Bailey wrote:
> I noticed in the temporal project they used reserved words for their
> functions (union, intersect, etc)
>
> But when I try to create a function like that I get an error and I have
> to quote it both when creating the function and when calling it. The
> only difference I can see is they their functions are written in C and
> mine are in SQL. But that doesn't make sense why you could do it in one
> language and not in another.
>
> What am I missing? And if it can be done, is there a strong preference
> in the community about whether it should be the reserved word or follow
> PostGIS's tack and prepend something to all of the functions like
> ts_union and ts_intersect?
As you've observed above, it's a really, really bad idea to name any
database object with a reserved word. Descriptive names are better.
That said, you *can* do it by double-quoting each.
SELECT "SELECT" FROM "FROM" WHERE "WHERE" = "=";
Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
From | Date | Subject | |
---|---|---|---|
Next Message | David Fetter | 2009-06-17 14:48:33 | Re: Playing with set returning functions in SELECT list - behaviour intended? |
Previous Message | Whit Armstrong | 2009-06-17 13:38:01 | how to cancel a query in progress |