Re: REFERENCES error message complaint, suggestion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: REFERENCES error message complaint, suggestion
Date: 2004-03-04 16:24:11
Message-ID: 26570.1078417451@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Karl O. Pinc" <kop(at)meme(dot)com> writes:
> On 2004.03.04 09:13 Tom Lane wrote:
>> I should have said something
>> like
>> ... constraint "f1 must be positive" check (f1 > 0)
>> if I were concerned about the error message quality.

> I tried this (in 7.3) only using single quotes instead of double quotes
> and got syntax errors. Where do I look in the docs to learn
> about this aspect of the syntax?

Double quotes are for names (identifiers). Single quotes are for string
literals (constants). In this case you're trying to write a nonstandard
name for a constraint, so you want double quotes.

> (I also note that the examples
> often single quote the plpgsql language keyword in CREATE FUNCTION
> statements, but I haven't and although I read through the whole
> manual didn't notice where such quotes are allowed and/or
> required.)

Those examples are old; the preferred syntax these days is to write the
language name as an identifier. But we used to, and still do, accept a
string literal for the language name. This is mentioned (very briefly)
on the CREATE FUNCTION reference page:

langname

The name of the language that the function is implemented in. May
be SQL, C, internal, or the name of a user-defined procedural
language. (See also createlang.) For backward compatibility, the
name may be enclosed by single quotes.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2004-03-04 16:33:12 Re: Enable/Disable triggers
Previous Message Pascal Polleunus 2004-03-04 16:18:46 Aggregate function capability with \d in psql