Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #744

Re: Why does this third line work, and the first two not?

From Rainer Weikusat <rweikusat@talktalk.net>
Newsgroups comp.databases.postgresql
Subject Re: Why does this third line work, and the first two not?
Date 2017-04-27 20:10 +0100
Message-ID <877f25y8d0.fsf@doppelsaurus.mobileactivedefense.com> (permalink)
References <59023252$0$785$e4fe514c@news.xs4all.nl>

Show all headers | View raw


Luuk <luuk@invalid.lan> writes:
> Why does this third line work, and the first two not?
>
> abcd=# select RequestMessageId from table_details;
> ERROR:  column "requestmessageid" does not exist
> LINE 1: select RequestMessageId from table_details;
>                ^
> HINT:  Perhaps you meant to reference the column
> "table_details.RequestMessageId".
>
> abcd=# select a.RequestMessageId from table_details a;
> ERROR:  column a.requestmessageid does not exist
> LINE 1: select a.RequestMessageId from table_details a;
>                ^
> HINT:  Perhaps you meant to reference the column "a.RequestMessageId".
>
> abcd=# select a."RequestMessageId" from table_details a;
>  RequestMessageId
> ------------------
> (0 rows)

That's because unquoted SQL identifiers are not case-sensitive. If the
really uses a mixed-case name, accessing it requires a quoted
identifier, cf

mad_database=# create table blubb ("Fump" varchar);
CREATE TABLE
mad_database=# select Fump from blubb;
ERROR:  column "fump" does not exist
LINE 1: select Fump from blubb;
               ^
mad_database=# select "Fump" from blubb;
 Fump 
------
(0 rows)

mad_database=# drop table blubb;
DROP TABLE
mad_database=# create table blubb (Fump varchar);
CREATE TABLE
mad_database=# select fUMP from blubb;
 fump 
------
(0 rows)

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Why does this third line work, and the first two not? Luuk <luuk@invalid.lan> - 2017-04-27 20:03 +0200
  Re: Why does this third line work, and the first two not? Ikke <hviaene@invalid.org> - 2017-04-27 20:53 +0200
    Re: Why does this third line work, and the first two not? Luuk <luuk@invalid.lan> - 2017-04-28 18:06 +0200
  Re: Why does this third line work, and the first two not? Rainer Weikusat <rweikusat@talktalk.net> - 2017-04-27 20:10 +0100
    Re: Why does this third line work, and the first two not? Luuk <luuk@invalid.lan> - 2017-04-28 18:07 +0200
      Re: Why does this third line work, and the first two not? Dimitri Fontaine <dimitri.fontaine@schibsted.com> - 2017-04-30 18:15 +0200
        Re: Why does this third line work, and the first two not? Luuk <luuk@invalid.lan> - 2017-04-30 21:48 +0200

csiph-web