473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Parenthesis in Queries

Is there a way to turn off the need to use parenthesis in queries for tablenames etc. I have seen in some documentation examples that parenthesis are not used in the queries. In my install of postgre 7.4 I get an error when I do not use them.

Example with parenthesis which works in my build
select * from portal."User"

where I would like to use
select * from portal.User

Thanks
Tim


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

Nov 23 '05 #1
4 2356
Oudenhoven, Timothy L wrote:
Is there a way to turn off the need to use parenthesis in queries for table names etc. I have seen in some documentation examples that parenthesis are not used in the queries. In my install of postgre 7.4 I get an error when I do not use them.

Example with parenthesis which works in my build
select * from portal."User"

where I would like to use
select * from portal.User

Thanks
Tim

Yes, sortof.

Just define all of your table and column names to be in lowercase.
Postgresql is sortof SQL standard here, in that names in quotes are
case-sensitive, and names without quotes give the illusion of case
insensitivity by turning them all into lowercase.

The deviation from the standard is because the standard dictates
"UPPERCASE". If you were to try the same thing on Oracle, my advice
would be "define all of your table and column names to be uppercase".

Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting
http://www.lingnu.com/
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2
Oudenhoven, Timothy L wrote:
Is there a way to turn off the need to use parenthesis in queries for table names etc. I have seen in some documentation examples that parenthesis are not used in the queries. In my install of postgre 7.4 I get an error when I do not use them.

Example with parenthesis which works in my build
select * from portal."User"

where I would like to use
select * from portal.User

Thanks
Tim

Yes, sortof.

Just define all of your table and column names to be in lowercase.
Postgresql is sortof SQL standard here, in that names in quotes are
case-sensitive, and names without quotes give the illusion of case
insensitivity by turning them all into lowercase.

The deviation from the standard is because the standard dictates
"UPPERCASE". If you were to try the same thing on Oracle, my advice
would be "define all of your table and column names to be uppercase".

Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting
http://www.lingnu.com/
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #3
El Dom 02 May 2004 17:15, Oudenhoven, Timothy L escribió:
Is there a way to turn off the need to use parenthesis in queries for table
names etc. I have seen in some documentation examples that parenthesis are
not used in the queries. In my install of postgre 7.4 I get an error when
I do not use them.

Example with parenthesis which works in my build
select * from portal."User"

where I would like to use
select * from portal.User


Does are not parenthesis, but doble quotes.

When you don't put quotes on the relations name, PG will lower case the name,
and there is where you get the error.

Solution: Don't use quoted relation names ever. This includes especially when
you create tables, becuase if you do this:

CREATE TABLE tab1 (
"ID" SERIAL,
"User" VARCHAR(30)
);

tab1.ID will not exist, becuase PG interprets it as tab1.id (see the case
difference), but will recognize pretty well tab1."ID".
--
08:35:02 up 5 days, 13:57, 2 users, load average: 0.63, 0.73, 0.75
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4
El Dom 02 May 2004 17:15, Oudenhoven, Timothy L escribió:
Is there a way to turn off the need to use parenthesis in queries for table
names etc. I have seen in some documentation examples that parenthesis are
not used in the queries. In my install of postgre 7.4 I get an error when
I do not use them.

Example with parenthesis which works in my build
select * from portal."User"

where I would like to use
select * from portal.User


Does are not parenthesis, but doble quotes.

When you don't put quotes on the relations name, PG will lower case the name,
and there is where you get the error.

Solution: Don't use quoted relation names ever. This includes especially when
you create tables, becuase if you do this:

CREATE TABLE tab1 (
"ID" SERIAL,
"User" VARCHAR(30)
);

tab1.ID will not exist, becuase PG interprets it as tab1.id (see the case
difference), but will recognize pretty well tab1."ID".
--
08:35:02 up 5 days, 13:57, 2 users, load average: 0.63, 0.73, 0.75
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Colossus | last post by:
Hi, I have a string like this: GeboGebo Wiki 0.9.2 (Default branch) I want to remove the words between the parenthesis. I tried this regexp: /\(\)/ but without success, what is wrong with it...
0
by: Gregory Nans | last post by:
hello, i need some help to 'tree-ify' a string... for example i have strings such as : s = """A(here 's , B(A ) silly test) C(to show D(what kind) of stuff i need))""" and i need to...
0
by: chenyu468 | last post by:
Hi, I am using (vc++) of vs.net 2003 for development. In the source code, there are too many right parenthesis in one section. I want to test which left parenthesis for one specified parenthesis....
16
by: Stephane | last post by:
Hi, I'm trying to replace parenthesis using Regex.replace but I'm always having this error: System.ArgumentException: parsing ":-)" - Too many )'s. Parameter name: :-) Here's my code: ...
38
by: Steve Kirsch | last post by:
I need a simple function that can match the number of beginning and ending parenthesis in an expression. Here's a sample expression: ( ( "john" ) and ( "jane" ) and ( "joe" ) ) Does .NET have...
2
by: Mike Cooper | last post by:
Hi all, I'm sure this is a really simple question for most. Below is a line of my code that doesn't work: SampleMacro = Replace(SampleMacro, ")", "") The error is "Too Many parenthesis"...
0
by: Oudenhoven, Timothy L | last post by:
Is there a way to turn off the need to use parenthesis in queries for tablenames etc. I have seen in some documentation examples that parenthesis are not used in the queries. In my install of...
7
by: Laurent Pointal | last post by:
on win32] Given the following: 45 .... (<generator object at 0x00A79788>,) .... File "<stdin>", line 1 SyntaxError: invalid syntax
2
by: voxiac | last post by:
Could someone tell me why: Fails with message: Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> re.compile('\\dir\\(file)') File "C:\Python25\lib\re.py", line 180,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.