473,508 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2367
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
7046
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
2405
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
963
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
9045
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
15912
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
1264
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
340
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
8101
by: Laurent Pointal | last post by:
on win32] Given the following: 45 .... (<generator object at 0x00A79788>,) .... File "<stdin>", line 1 SyntaxError: invalid syntax
2
2406
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
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.