473,569 Members | 2,731 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 2369
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
7051
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 ? Thank you, --
0
2410
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 parse them to have a tree representation such as :
0
971
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. How should I do? Thank you in advance. kind regards chenyu
16
9051
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: Regex.Replace(input,":-)","img",RegexOptions.Compiled |
38
15938
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 something built-in that can accomplish this, or do I have to write my own parser? I don't want to reinvent the wheel if possible.
2
1266
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" even though the target of my replace command is in quotes. When I change the right parenthesis in
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 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...
7
8104
by: Laurent Pointal | last post by:
on win32] Given the following: 45 .... (<generator object at 0x00A79788>,) .... File "<stdin>", line 1 SyntaxError: invalid syntax
2
2410
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, in compile return _compile(pattern, flags) File "C:\Python25\lib\re.py", line 233, in _compile
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.