From 1bd22f55cf1e5e80ab0b7704adf9678cacaca69b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 19 Jun 2003 23:22:40 +0000 Subject: Disallow dollar sign in operator names, instead allow it as a non-first character in identifiers. The first change eliminates the current need to put spaces around parameter references, as in "x<=$2". The second change improves compatibility with Oracle and some other RDBMSes. This was discussed and agreed to back in January, but did not get done. --- doc/src/sgml/release.sgml | 4 +++- doc/src/sgml/syntax.sgml | 37 +++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) (limited to 'doc') diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index 382029b81ff..cc03ae9cbe3 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -24,6 +24,8 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. --> @@ -109,10 +109,15 @@ INSERT INTO MY_TABLE VALUES (3, 'hi there'); (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or - key word can be letters, digits - (0-9), or underscores, - although the SQL standard will not define a key word that contains - digits or starts or ends with an underscore. + key word can be letters, underscores, digits + (0-9), or dollar signs + ($). Note that dollar signs are not allowed in identifiers + according to the letter of the SQL standard, so their use may render + applications less portable. + The SQL standard will not define a key word that contains + digits or starts or ends with an underscore, so identifiers of this + form are safe against possible conflict with future extensions of the + standard. @@ -478,18 +483,11 @@ CAST ( 'string' AS type ) An operator is a sequence of up to NAMEDATALEN-1 (63 by default) characters from the following list: -+ - * / < > = ~ ! @ # % ^ & | ` ? $ ++ - * / < > = ~ ! @ # % ^ & | ` ? There are a few restrictions on operator names, however: - - - $ (dollar) cannot be a single-character operator, although it - can be part of a multiple-character operator name. - - - -- and /* cannot appear @@ -503,7 +501,7 @@ CAST ( 'string' AS type ) A multiple-character operator name cannot end in + or -, unless the name also contains at least one of these characters: -~ ! @ # % ^ & | ` ? $ +~ ! @ # % ^ & | ` ? For example, @- is an allowed operator name, but *- is not. This restriction allows @@ -539,9 +537,9 @@ CAST ( 'string' AS type ) A dollar sign ($) followed by digits is used - to represent the positional parameters in the body of a function + to represent a positional parameter in the body of a function definition or a prepared statement. In other contexts the - dollar sign may be part of an operator name. + dollar sign may be part of an identifier. @@ -965,9 +963,12 @@ SELECT 3 OPERATOR(pg_catalog.+) 4; Positional Parameters - A positional parameter reference is used to indicate a parameter + A positional parameter reference is used to indicate a value that is supplied externally to an SQL statement. Parameters are - used in SQL function definitions and in prepared queries. + used in SQL function definitions and in prepared queries. Some + client libraries also support specifying data values separately + from the SQL command string, in which case parameters are used to + refer to the out-of-line data values. The form of a parameter reference is: $number -- cgit v1.2.3