SQL naming rules - AWS Clean Rooms

SQL naming rules

The following sections explain the SQL naming rules in AWS Clean Rooms.

Configured table association names and columns

Members who can query use configured table association names as table names in queries. Configured table association names and configured table columns can be aliased in queries.

The following naming rules apply to configured table association names, configured table column names, and aliases:

  • They must use only alphanumeric, underscore (_), or hyphen (-) characters but cannot start or end with a hyphen.

    • (Custom analysis rule only) They can use the dollar sign ($) but cannot use a pattern that follows a dollar-quoted string constant.

      A dollar-quoted string constant consists of:

      • a dollar sign ($)

      • an optional "tag" of zero or more characters

      • another dollar sign

      • arbitrary sequence of characters that makes up the string content

      • a dollar sign ($)

      • the same tag that began the dollar quote

      • a dollar sign

        For example: $$invalid$$

  • They cannot contain consecutive hyphen (-) characters.

  • They cannot begin with any of the following prefixes:

    padb_, pg_, stcs_, stl_, stll_, stv_, svcs_, svl_, svv_, sys_, systable_

  • They cannot contain backslash characters (\) , quotation marks ('), or spaces that are not double-quoted.

  • If they start with a non-alphabetical character, they must be within double-quotes (" ").

  • If they contain a hyphen (-) character, they must be within double-quotes (" ").

  • They must be between 1 and 127 characters in length.

  • Reserved words must be within double-quotes (" ").

  • The following column names are reserved cannot be used in AWS Clean Rooms (even with quotes):

    • oid

    • tableoid

    • xmin

    • cmin

    • xmax

    • cmax

    • ctid

Literals

A literal or constant is a fixed data value, composed of a sequence of characters or a numeric constant.

The following naming rules are for literals in AWS Clean Rooms:

  • Numeric, character and date, time, and timestamp literals are supported.

  • Only TAB, CARRIAGE RETURN (CR), and LINE FEED (LF) Unicode control characters from the Unicode general category (Cc) are supported.

  • Direct references to literals in the projection list are not supported in the SELECT statement.

    For example:

    SELECT 'test', consumer.first_purchase_day FROM consumer INNER JOIN provider2 ON consumer.hashed_email = provider2.hashedemail

Reserved words

The following is a list of reserved words in AWS Clean Rooms.

AES128

DELTA32KDESC

LEADING

PRIMARY

AES256ALL

DISTINCT

LEFTLIKE

RAW

ALLOWOVERWRITEANALYSE

DO

LIMIT

READRATIO

ANALYZE

DISABLE

LOCALTIME

RECOVERREFERENCES

AND

ELSE

LOCALTIMESTAMP

REJECTLOG

ANY

EMPTYASNULLENABLE

LUN

RESORT

ARRAY

ENCODE

LUNS

RESPECT

AS

ENCRYPT

LZO

RESTORE

ASC

ENCRYPTIONEND

LZOP

RIGHTSELECT

AUTHORIZATION

EXCEPT

MINUS

SESSION_USER

AZ64

EXPLICITFALSE

MOSTLY16

SIMILAR

BACKUPBETWEEN

FOR

MOSTLY32

SNAPSHOT

BINARY

FOREIGN

MOSTLY8NATURAL

SOME

BLANKSASNULLBOTH

FREEZE

NEW

SYSDATESYSTEM

BYTEDICT

FROM

NOT

TABLE

BZIP2CASE

FULL

NOTNULL

TAG

CAST

GLOBALDICT256

NULL

TDES

CHECK

GLOBALDICT64KGRANT

NULLSOFF

TEXT255

COLLATE

GROUP

OFFLINEOFFSET

TEXT32KTHEN

COLUMN

GZIPHAVING

OID

TIMESTAMP

CONSTRAINT

IDENTITY

OLD

TO

CREATE

IGNOREILIKE

ON

TOPTRAILING

CREDENTIALSCROSS

IN

ONLY

TRUE

CURRENT_DATE

INITIALLY

OPEN

TRUNCATECOLUMNSUNION

CURRENT_TIME

INNER

OR

UNIQUE

CURRENT_TIMESTAMP

INTERSECT

ORDER

UNNEST

CURRENT_USER

INTERVAL

OUTER

USING

CURRENT_USER_IDDEFAULT

INTO

OVERLAPS

VERBOSE

DEFERRABLE

IS

PARALLELPARTITION

WALLETWHEN

DEFLATE

ISNULL

PERCENT

WHERE

DEFRAG

JOIN

PERMISSIONS

WITH

DELTA

LANGUAGE

PIVOTPLACING

WITHOUT