Thread: disallowed characters in table names?

disallowed characters in table names?

From
Steve Lefevre
Date:
Can someone point me to a resource where I can find the disallowed
characters in Postgres database, table, and field names? The only
resource I can find on searches are information about character field
types.

Thanks!

Steve Lefevre

Re: disallowed characters in table names?

From
Michael Glaesemann
Date:
On Jun 10, 2007, at 20:33 , Steve Lefevre wrote:

> Can someone point me to a resource where I can find the disallowed
> characters in Postgres database, table, and field names? The only
> resource I can find on searches are information about character
> field types.

http://www.postgresql.org/docs/8.2/interactive/sql-syntax-
lexical.html#SQL-SYNTAX-IDENTIFIERS

Michael Glaesemann
grzm seespotcode net



Re: disallowed characters in table names?

From
Tom Lane
Date:
Steve Lefevre <lefevre.10@osu.edu> writes:
> Can someone point me to a resource where I can find the disallowed
> characters in Postgres database, table, and field names?

http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

For an unquoted name, it's basically a-z, underscore, plus any and
all non-ASCII characters, plus digits and $ after the first character.
The nitty-gritty is the flex definition:

ident_start        [A-Za-z\200-\377_]
ident_cont        [A-Za-z\200-\377_0-9\$]
identifier        {ident_start}{ident_cont}*

Quoted names allow anything at all except \0.

            regards, tom lane

Formatting function, simple Q

From
nhrcommu@rochester.rr.com
Date:
Folks,

I reviewed
http://www.postgresql.org/docs/current/static/functions-formatting.html
and I am wondering in the examples section, if there is a way to avoid the
" " between the DM and the 485.

to_char(485, 'L999')    'DM 485

Our locale, I'd be looking for '$485', without a space.
Does this just reflect a US currency quirk?

Thanks,
Mike Ellsworth




Re: Formatting function, simple Q

From
Tom Lane
Date:
nhrcommu@rochester.rr.com writes:
> I reviewed
> http://www.postgresql.org/docs/current/static/functions-formatting.html
> and I am wondering in the examples section, if there is a way to avoid the
> " " between the DM and the 485.

> to_char(485, 'L999')    'DM 485

I think it's leaving that for a sign.

> Our locale, I'd be looking for '$485', without a space.

Really?

regression=# set lc_monetary TO 'en_US.iso88591';
SET
regression=# select to_char(485, 'L999');
 to_char
---------
 $ 485
(1 row)

Anyway, I think you need 'FM' to get rid of the unused space.

regression=# select to_char(485, 'FML999');
 to_char
---------
 $485
(1 row)

            regards, tom lane

Re: Formatting function, simple Q

From
nhrcommu@rochester.rr.com
Date:
> Anyway, I think you need 'FM' to get rid of the unused space.
>
> regression=# select to_char(485, 'FML999');
> to_char
> ---------
> $485
> (1 row)


Thanks Tom.  Exactly what I was looking for.