Make discussion of names clearer and more accurate.
This commit is contained in:
parent
996bc5358c
commit
175dbf741b
@ -340,17 +340,23 @@ A comment beginning with "/*" extends to the first occurrence of "*/".
|
|||||||
<title>Names</title>
|
<title>Names</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Names in SQL are sequences of less than NAMEDATALEN alphanumeric characters,
|
Names in SQL must begin with a letter
|
||||||
starting with an alphabetic character. By default, NAMEDATALEN is set
|
(<literal>a</literal>-<literal>z</literal>) or underscore
|
||||||
to 32 (but at the time the system is built, NAMEDATALEN can be changed
|
(<literal>_</literal>).
|
||||||
by changing the <literal>#define</literal> in
|
Subsequent characters in a name can be letters, digits
|
||||||
src/backend/include/postgres.h).
|
(<literal>0</literal>-<literal>9</literal>),
|
||||||
Underscore ("_") is considered an alphabetic character.
|
or underscores. The system uses no more than NAMEDATALEN-1 characters
|
||||||
|
of a name; longer names can be written in queries, but they will be
|
||||||
|
truncated.
|
||||||
|
By default, NAMEDATALEN is 32 so the maximum name length is 31 (but
|
||||||
|
at the time the system is built, NAMEDATALEN can be changed in
|
||||||
|
src/include/postgres_ext.h).
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Names containing other characters may be formed by surrounding them
|
Names containing other characters may be formed by surrounding them
|
||||||
with double quotes. For example, table or column names may contain
|
with double quotes (<literal>"</literal>). For example, table or column
|
||||||
|
names may contain
|
||||||
otherwise disallowed characters such as spaces, ampersands, etc. if
|
otherwise disallowed characters such as spaces, ampersands, etc. if
|
||||||
quoted. Quoting a name also makes it case-sensitive,
|
quoted. Quoting a name also makes it case-sensitive,
|
||||||
whereas unquoted names are always folded to lower case. For example,
|
whereas unquoted names are always folded to lower case. For example,
|
||||||
@ -359,6 +365,12 @@ A comment beginning with "/*" extends to the first occurrence of "*/".
|
|||||||
considered the same by <productname>Postgres</productname>, but
|
considered the same by <productname>Postgres</productname>, but
|
||||||
<literal>"Foo"</literal> is a different name.
|
<literal>"Foo"</literal> is a different name.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Double quotes can also be used to protect a name that would otherwise
|
||||||
|
be taken to be an SQL keyword. For example, <literal>IN</literal>
|
||||||
|
is a keyword but <literal>"IN"</literal> is a name.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1>
|
<sect1>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user