Re: table name
От | Alban Hertroys |
---|---|
Тема | Re: table name |
Дата | |
Msg-id | B55AFAD6-264F-4473-9661-F9DE091EDBE5@gmail.com обсуждение исходный текст |
Ответ на | Re: table name (Paul Förster <paul.foerster@gmail.com>) |
Список | pgsql-general |
> On 11 Jun 2020, at 20:58, Paul Förster <paul.foerster@gmail.com> wrote: > > Hi Marc, > >> On 11. Jun, 2020, at 20:54, Marc Millas <marc.millas@mokadb.com> wrote: >> sorry if my question is tooo simple :-) > > it's not. :-) > >> obviously if I ask: >> select * from regions-20180101; >> I get a syntax error. >> if I try select * from $$regions_20180101$$; >> I get another syntax error. >> If I try to rename that table, same thing. >> if I try a cte, same thing. >> >> What should I do ? > > you can just quote its name: > > select * from "regions-20180101"; > > Cheers, > Paul The background here is that ‘’ and $$ are quoting of literals (strings, integers, JSON objects, etc.), while “” is identifierquoting (tables, indices, types, etc.). Identifier quoting not only allows to include special symbols, it also makes the identifier case-sensitive. That’s probablywhy Paul suggested to rename the table to no longer require identifier quoting - many people consider it a PITA,but it can be used to get out of trouble like yours - some people insist on it, for example because it makes using camel-capsin identifiers meaningful. Regards, Alban Hertroys -- There is always an exception to always.
В списке pgsql-general по дате отправления: