pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQuery about SQL in PostgreSQL
9+ messages / 8 participants
[nested] [flat]
* Query about SQL in PostgreSQL
@ 2005-04-19 09:48 Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
0 siblings, 5 replies; 9+ messages in thread
From: Muhammad Nadeem Ashraf @ 2005-04-19 09:48 UTC (permalink / raw)
To: pgsql-sql
Hi,
I am new user of PostGreSQL 8.0.1. While using it i faced following issue. As SQL is Case insensetive Language So the Uper or Lower cases are not significant. But while using the database there is problem.
If i Create new Table with name (tblstudent) then upon SQL queries it is fine to use Select * from tblstudent. However i face probel if i give the name of table in Capital letters i.e. if the name is (tblStudent) then upon using Select * from tblStudent, following error is appeard:
ERROR: relation "tblst" does not exist
And if i use the query Select * from "tblStudent" then it works fine.
Please help me out in this regard.
Nadeem
---------------------------------
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 09:58 Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>
parent: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
4 siblings, 0 replies; 9+ messages in thread
From: Reinoud van Leeuwen @ 2005-04-19 09:58 UTC (permalink / raw)
To: pgsql-sql
On Tue, Apr 19, 2005 at 02:48:46AM -0700, Muhammad Nadeem Ashraf wrote:
> Hi,
> I am new user of PostGreSQL 8.0.1. While using it i faced following
> issue. As SQL is Case insensetive Language So the Uper or Lower cases
> are not significant. But while using the database there is problem.
> If i Create new Table with name (tblstudent) then upon SQL queries it
> is fine to use Select * from tblstudent. However i face probel if i give
> the name of table in Capital letters i.e. if the name is (tblStudent)
> then upon using Select * from tblStudent, following error is appeard:
> ERROR: relation "tblst" does not exist
>
> And if i use the query Select * from "tblStudent" then it works fine.
>
>
> Please help me out in this regard.
What exactly is the problem? Just use the names of tables you have
created.
--
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen reinoud.v@n.leeuwen.net
http://www.xs4all.nl/~reinoud
__________________________________________________
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 09:59 KÖPFERL Robert <robert.koepferl@sonorys.at>
0 siblings, 1 reply; 9+ messages in thread
From: KÖPFERL Robert @ 2005-04-19 09:59 UTC (permalink / raw)
To: pgsql-sql
Postgres has the weird behavour to compare identifies case sensitive BUT to
downcast any non-quoted identifier inside an SQL statement.
So it is reccomended to just use lower case (for readability)
-----Original Message-----
From: Muhammad Nadeem Ashraf [mailto:nadeem_engg@yahoo.com]
Sent: Dienstag, 19. April 2005 11:49
To: pgsql-sql@postgresql.org
Subject: [SQL] Query about SQL in PostgreSQL
Hi,
I am new user of PostGreSQL 8.0.1. While using it i faced following issue.
As SQL is Case insensetive Language So the Uper or Lower cases are not
significant. But while using the database there is problem.
If i Create new Table with name (tblstudent) then upon SQL queries it is
fine to use Select * from tblstudent. However i face probel if i give the
name of table in Capital letters i.e. if the name is (tblStudent) then upon
using Select * from tblStudent, following error is appeard:
ERROR: relation "tblst" does not exist
And if i use the query Select * from "tblStudent" then it works fine.
Please help me out in this regard.
Nadeem
_____
Yahoo! Mail Mobile
Take
<http://us.rd.yahoo.com/mail_us/taglines/mobile/*http://mobile.yahoo.com/lea
rn/mail> Yahoo! Mail with you! Check email on your mobile phone.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 10:16 Sean Davis <sdavis2@mail.nih.gov>
parent: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
4 siblings, 0 replies; 9+ messages in thread
From: Sean Davis @ 2005-04-19 10:16 UTC (permalink / raw)
To: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>; +Cc: pgsql-sql
On Apr 19, 2005, at 5:48 AM, Muhammad Nadeem Ashraf wrote:
> Hi,
> I am new user of PostGreSQL 8.0.1. While using it i faced following
> issue. As SQL is Case insensetive Language So the Uper or Lower cases
> are not significant. But while using the database there is problem.
> If i Create new Table with name (tblstudent) then upon SQL queries it
> is fine to use Select * from tblstudent. However i face probel if i
> give the name of table in Capital letters i.e. if the name is
> (tblStudent) then upon using Select * from tblStudent, following error
> is appeard:
> ERROR: relation "tblst" does not exist
>
> And if i use the query Select * from "tblStudent" then it works fine.
SQL is case insensitive. However, identifiers (table names, column
names, index names, etc.) are case sensitive in Postgresql. So, your
operational understanding of how things work seems to be correct. I
tend to use all lower-case, just because it saves me some thought, but
I know some folks like to use a mix of upper and lower case so that
they can be used in a web application, for example. If you do use
mixed or upper case, you do have to quote them.
If you still have a problem, could you be more specific about what it
is?
Sean
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 10:35 Thomas Kellerer <spam_eater@gmx.net>
parent: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
4 siblings, 0 replies; 9+ messages in thread
From: Thomas Kellerer @ 2005-04-19 10:35 UTC (permalink / raw)
To: pgsql-sql
On 19.04.2005 11:48 Muhammad Nadeem Ashraf wrote:
> Hi,
> I am new user of PostGreSQL 8.0.1. While using it i faced following
> issue. As SQL is Case insensetive Language So the Uper or Lower cases
> are not significant. But while using the database there is problem.
> If i Create new Table with name (tblstudent) then upon SQL queries it is
> fine to use Select * from tblstudent. However i face probel if i give
> the name of table in Capital letters i.e. if the name is (tblStudent)
> then upon using Select * from tblStudent, following error is appeard:
> ERROR: relation "tblst" does not exist
>
> And if i use the query Select * from "tblStudent" then it works fine.
>
>
This is how SQL is defined in the ANSI standard. If you use double quotes around
your object names, then it's case sensitiv. If you omit the double quotes it's
not. General rule: do not use double quotes at all, and your fine (this is true
for other DBMS like Oracle and Firebird as well)
Thomas
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 10:58 Richard Huxton <dev@archonet.com>
parent: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
4 siblings, 0 replies; 9+ messages in thread
From: Richard Huxton @ 2005-04-19 10:58 UTC (permalink / raw)
To: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>; +Cc: pgsql-sql
Muhammad Nadeem Ashraf wrote:
> Hi,
> I am new user of PostGreSQL 8.0.1. While using it i faced following
> issue. As SQL is Case insensetive Language So the Uper or Lower cases
> are not significant. But while using the database there is problem.
> If i Create new Table with name (tblstudent) then upon SQL queries it is
> fine to use Select * from tblstudent. However i face probel if i give
> the name of table in Capital letters i.e. if the name is (tblStudent)
> then upon using Select * from tblStudent, following error is appeard:
> ERROR: relation "tblst" does not exist
>
> And if i use the query Select * from "tblStudent" then it works fine.
If you quote your table-names when you create them you should always
quote them when you use them.
If you don't quote your table-names when you create them, there is no
need to quote them when you use them.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 13:25 Andrew Sullivan <ajs@crankycanuck.ca>
parent: KÖPFERL Robert <robert.koepferl@sonorys.at>
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Sullivan @ 2005-04-19 13:25 UTC (permalink / raw)
To: pgsql-sql
On Tue, Apr 19, 2005 at 11:59:58AM +0200, KÖPFERL Robert wrote:
> Postgres has the weird behavour to compare identifies case sensitive BUT to
> downcast any non-quoted identifier inside an SQL statement.
> So it is reccomended to just use lower case (for readability)
Or never double-quote identifiers. I sort of don't believe exactly
the original poster's report, however, because the error message
wasn't right no matter what. I'd like to see a real session
transcript. Also, this probably belongs on -general.
A
--
Andrew Sullivan | ajs@crankycanuck.ca
Information security isn't a technological problem. It's an economics
problem.
--Bruce Schneier
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 14:17 Jeff Eckermann <jeff_eckermann@yahoo.com>
parent: Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
4 siblings, 1 reply; 9+ messages in thread
From: Jeff Eckermann @ 2005-04-19 14:17 UTC (permalink / raw)
To: pgsql-sql
"Muhammad Nadeem Ashraf" <nadeem_engg@yahoo.com> wrote in message
news:20050419094846.21474.qmail@web50506.mail.yahoo.com...
> Hi,
> I am new user of PostGreSQL 8.0.1. While using it i faced following issue.
> As SQL is Case insensetive Language So the Uper or Lower cases are not
> significant. But while using the database there is problem.
> If i Create new Table with name (tblstudent) then upon SQL queries it is
> fine to use Select * from tblstudent. However i face probel if i give the
> name of table in Capital letters i.e. if the name is (tblStudent) then
> upon using Select * from tblStudent, following error is appeard:
> ERROR: relation "tblst" does not exist
That should have worked. Can you provide a session transcript that shows
this?
>
> And if i use the query Select * from "tblStudent" then it works fine.
>
>
> Please help me out in this regard.
> Nadeem
>
>
>
> ---------------------------------
> Yahoo! Mail Mobile
> Take Yahoo! Mail with you! Check email on your mobile phone.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: Query about SQL in PostgreSQL
@ 2005-04-19 14:25 Jeff Eckermann <jeff_eckermann@yahoo.com>
parent: Jeff Eckermann <jeff_eckermann@yahoo.com>
0 siblings, 0 replies; 9+ messages in thread
From: Jeff Eckermann @ 2005-04-19 14:25 UTC (permalink / raw)
To: pgsql-sql
Forget that message. I need another cup of coffee!
"Jeff Eckermann" <jeff_eckermann@yahoo.com> wrote in message
news:d433uh$2ujf$2@news.hub.org...
> "Muhammad Nadeem Ashraf" <nadeem_engg@yahoo.com> wrote in message
> news:20050419094846.21474.qmail@web50506.mail.yahoo.com...
>> Hi,
>> I am new user of PostGreSQL 8.0.1. While using it i faced following
>> issue. As SQL is Case insensetive Language So the Uper or Lower cases are
>> not significant. But while using the database there is problem.
>> If i Create new Table with name (tblstudent) then upon SQL queries it is
>> fine to use Select * from tblstudent. However i face probel if i give the
>> name of table in Capital letters i.e. if the name is (tblStudent) then
>> upon using Select * from tblStudent, following error is appeard:
>> ERROR: relation "tblst" does not exist
>
> That should have worked. Can you provide a session transcript that shows
> this?
>
>>
>> And if i use the query Select * from "tblStudent" then it works fine.
>>
>>
>> Please help me out in this regard.
>> Nadeem
>>
>>
>>
>> ---------------------------------
>> Yahoo! Mail Mobile
>> Take Yahoo! Mail with you! Check email on your mobile phone.
>
>
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2005-04-19 14:25 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 09:48 Query about SQL in PostgreSQL Muhammad Nadeem Ashraf <nadeem_engg@yahoo.com>
2005-04-19 09:58 ` Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>
2005-04-19 10:16 ` Sean Davis <sdavis2@mail.nih.gov>
2005-04-19 10:35 ` Thomas Kellerer <spam_eater@gmx.net>
2005-04-19 10:58 ` Richard Huxton <dev@archonet.com>
2005-04-19 14:17 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
2005-04-19 14:25 ` Jeff Eckermann <jeff_eckermann@yahoo.com>
2005-04-19 09:59 Re: Query about SQL in PostgreSQL KÖPFERL Robert <robert.koepferl@sonorys.at>
2005-04-19 13:25 ` Andrew Sullivan <ajs@crankycanuck.ca>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox