@@ -340,17 +340,23 @@ A comment beginning with "/*" extends to the first occurrence of "*/".
340
340
<title>Names</title>
341
341
342
342
<para>
343
- Names in SQL are sequences of less than NAMEDATALEN alphanumeric characters,
344
- starting with an alphabetic character. By default, NAMEDATALEN is set
345
- to 32 (but at the time the system is built, NAMEDATALEN can be changed
346
- by changing the <literal>#define</literal> in
347
- src/backend/include/postgres.h).
348
- Underscore ("_") is considered an alphabetic character.
343
+ Names in SQL must begin with a letter
344
+ (<literal>a</literal>-<literal>z</literal>) or underscore
345
+ (<literal>_</literal>).
346
+ Subsequent characters in a name can be letters, digits
347
+ (<literal>0</literal>-<literal>9</literal>),
348
+ or underscores. The system uses no more than NAMEDATALEN-1 characters
349
+ of a name; longer names can be written in queries, but they will be
350
+ truncated.
351
+ By default, NAMEDATALEN is 32 so the maximum name length is 31 (but
352
+ at the time the system is built, NAMEDATALEN can be changed in
353
+ src/include/postgres_ext.h).
349
354
</para>
350
355
351
356
<para>
352
357
Names containing other characters may be formed by surrounding them
353
- with double quotes. For example, table or column names may contain
358
+ with double quotes (<literal>"</literal>). For example, table or column
359
+ names may contain
354
360
otherwise disallowed characters such as spaces, ampersands, etc. if
355
361
quoted. Quoting a name also makes it case-sensitive,
356
362
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 "*/".
359
365
considered the same by <productname>Postgres</productname>, but
360
366
<literal>"Foo"</literal> is a different name.
361
367
</para>
368
+
369
+ <para>
370
+ Double quotes can also be used to protect a name that would otherwise
371
+ be taken to be an SQL keyword. For example, <literal>IN</literal>
372
+ is a keyword but <literal>"IN"</literal> is a name.
373
+ </para>
362
374
</sect1>
363
375
364
376
<sect1>
0 commit comments