Thread: column names with - and (

column names with - and (

From
"maria s"
Date:
<div dir="ltr">Hi All,<br />When I am fetching the data from a table,<br />I am giving the column names with - and (
and) like IL-a, IL-a(p30) etc..<br /><br />select x1 as IL-a, x2 as IL-a(p30) from abc<br /><br />But I am getting <br
/><br/>ERROR:  syntax error at or near "-" and also t "(" , ")"<br /><br />Can anyone help me to fix this?<br /><br
/>Thankyou,<br />Maria<br /></div> 

Re: column names with - and (

From
"Oliveiros Cristina"
Date:
Maria,
 
The minus, open bracket and close bracket are illegal as identifier names
 
 
Best,
Oliveiros
 
----- Original Message -----
From: maria s
Sent: Tuesday, July 29, 2008 5:06 PM
Subject: [SQL] column names with - and (

Hi All,
When I am fetching the data from a table,
I am giving the column names with - and ( and ) like IL-a, IL-a(p30) etc..

select x1 as IL-a, x2 as IL-a(p30) from abc

But I am getting

ERROR:  syntax error at or near "-" and also t "(" , ")"

Can anyone help me to fix this?

Thank you,
Maria

Re: column names with - and (

From
"maria s"
Date:

Hi Oliveiros,
Thanks for the link. Yes I read it.

But I am using "" for the column names. So now I am getting the result that I need.

Thanks for all your help.

Maria

On Tue, Jul 29, 2008 at 12:27 PM, Oliveiros Cristina <oliveiros.cristina@marktest.pt> wrote:
Maria,
 
The minus, open bracket and close bracket are illegal as identifier names
 
 
Best,
Oliveiros
 
----- Original Message -----
From: maria s
Sent: Tuesday, July 29, 2008 5:06 PM
Subject: [SQL] column names with - and (

Hi All,
When I am fetching the data from a table,
I am giving the column names with - and ( and ) like IL-a, IL-a(p30) etc..

select x1 as IL-a, x2 as IL-a(p30) from abc

But I am getting

ERROR:  syntax error at or near "-" and also t "(" , ")"

Can anyone help me to fix this?

Thank you,
Maria

Re: column names with - and (

From
"Oliveiros Cristina"
Date:
You can enclose the names in quotes, then the characters are allowed
 
Sorry to mislead you :p
 
Best,
Oliveiros
 
 
----- Original Message -----
Sent: Tuesday, July 29, 2008 5:27 PM
Subject: Re: [SQL] column names with - and (

Maria,
 
The minus, open bracket and close bracket are illegal as identifier names
 
 
Best,
Oliveiros
 
----- Original Message -----
From: maria s
Sent: Tuesday, July 29, 2008 5:06 PM
Subject: [SQL] column names with - and (

Hi All,
When I am fetching the data from a table,
I am giving the column names with - and ( and ) like IL-a, IL-a(p30) etc..

select x1 as IL-a, x2 as IL-a(p30) from abc

But I am getting

ERROR:  syntax error at or near "-" and also t "(" , ")"

Can anyone help me to fix this?

Thank you,
Maria

Re: column names with - and (

From
"maria s"
Date:
Its okay, Yes I am using quotes. Michael was telling that too.

Thanks for all the help at all times.

Maria


On Tue, Jul 29, 2008 at 12:37 PM, Oliveiros Cristina <oliveiros.cristina@marktest.pt> wrote:
You can enclose the names in quotes, then the characters are allowed
 
Sorry to mislead you :p
 
Best,
Oliveiros
 
 
----- Original Message -----
Sent: Tuesday, July 29, 2008 5:27 PM
Subject: Re: [SQL] column names with - and (

Maria,
 
The minus, open bracket and close bracket are illegal as identifier names
 
 
Best,
Oliveiros
 
----- Original Message -----
From: maria s
Sent: Tuesday, July 29, 2008 5:06 PM
Subject: [SQL] column names with - and (

Hi All,
When I am fetching the data from a table,
I am giving the column names with - and ( and ) like IL-a, IL-a(p30) etc..

select x1 as IL-a, x2 as IL-a(p30) from abc

But I am getting

ERROR:  syntax error at or near "-" and also t "(" , ")"

Can anyone help me to fix this?

Thank you,
Maria

Re: column names with - and (

From
"Igor Neyman"
Date:
Maria,
 
Try "" (double quotes:
 
select x1 as "IL-a", x2 as "IL-a(p30)" from abc
 
should help.
 
Igor

 


From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of maria s
Sent: Tuesday, July 29, 2008 12:07 PM
To: Osvaldo Rosario Kussama; pgsql-sql@postgresql.org; Pavel Stehule; Ivan Sergio Borgonovo
Subject: [SQL] column names with - and (

Hi All,
When I am fetching the data from a table,
I am giving the column names with - and ( and ) like IL-a, IL-a(p30) etc..

select x1 as IL-a, x2 as IL-a(p30) from abc

But I am getting

ERROR:  syntax error at or near "-" and also t "(" , ")"

Can anyone help me to fix this?

Thank you,
Maria

Re: column names with - and (

From
"maria s"
Date:
Hi Igor,
Thanks for the info.
I am using double quotes now and getting the result that I needed.

Thank you,
Maria



On Tue, Jul 29, 2008 at 3:14 PM, Igor Neyman <ineyman@perceptron.com> wrote:
Maria,
 
Try "" (double quotes:
 
select x1 as "IL-a", x2 as "IL-a(p30)" from abc
 
should help.
 
Igor

 


From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of maria s
Sent: Tuesday, July 29, 2008 12:07 PM

To: Osvaldo Rosario Kussama; pgsql-sql@postgresql.org; Pavel Stehule; Ivan Sergio Borgonovo
Subject: [SQL] column names with - and (

Hi All,
When I am fetching the data from a table,
I am giving the column names with - and ( and ) like IL-a, IL-a(p30) etc..

select x1 as IL-a, x2 as IL-a(p30) from abc

But I am getting

ERROR:  syntax error at or near "-" and also t "(" , ")"

Can anyone help me to fix this?

Thank you,
Maria