Search Postgresql Archives

Re: Help with queries...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The book says:
There is a second kind of identifier: the delimited identifier or quoted identifier. It is formed by enclosing an arbitrary sequence of characters in double-quotes ("). A delimited identifier is always an identifier, never a key word. So "select" could be used to refer to a column or table named "select", whereas an unquoted select would be taken as a key word and would therefore provoke a parse error when used where a table or column name is expected. The example can be written with quoted identifiers like this:


UPDATE "my_table" SET "a" = 5;
Quoted identifiers can contain any character other than a double quote itself. (To include a double quote, write two double quotes.) This allows constructing table or column names that would otherwise not be possible, such as ones containing spaces or ampersands. The length limitation still applies.


But my table name Grupos is not a reserved keyword, so SELECT * FROM Grupos; should work, right??? but guess what... It doesn't work too... I need to pass SELECT * FROM "Grupos";



----- Original Message ----- From: "Michael Fuhr" <mike@xxxxxxxx>
To: "Cristian Prieto" <cristian@xxxxxxxxxxxxxxx>
Cc: <pgsql-general@xxxxxxxxxxxxxx>
Sent: Thursday, February 24, 2005 2:44 PM
Subject: Re: Help with queries...



On Thu, Feb 24, 2005 at 02:33:28PM -0600, Cristian Prieto wrote:

select * from users;
ERROR:  relation "users" does not exist

but:
select * from "Users";
returns all the data I want...

See "Identifiers and Keywords" in the "SQL Syntax" chapter of the documentation, especially the parts that talk about case and quoting:

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

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/




---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux