Re: Variable column name

From: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
To: <rod(at)iol(dot)ie>
Cc: "Bill Moran" <wmoran(at)potentialtech(dot)com>, "Postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Variable column name
Date: 2011-09-02 17:45:42
Message-ID: F5352B6A066D447A98E3E7E3DE0AC8EF@BobPC
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----Original Message-----
From: Raymond O'Donnell
Sent: Friday, September 02, 2011 10:38 AM
To: Bob Pawley
Cc: Bill Moran ; Postgresql
Subject: Re: [GENERAL] Variable column name

On 02/09/2011 18:33, Bob Pawley wrote:
>
>
> -----Original Message-----
>> From: Bill Moran
> Sent: Thursday, September 01, 2011 8:19 AM
> To: Bob Pawley
> Cc: Postgresql
> Subject: Re: [GENERAL] Variable column name
>
> http://www.postgresql.org/docs/9.0/static/plpgsql-statements.html
> Section 39.5.4
>
> If you're not familiar with plpgsql at all, you might want to start with
> this:
> http://www.postgresql.org/docs/9.0/static/plpgsql-structure.html
>
>
> Thanks for the suggestion.
>
> Following is my interpretation of what I have read.
>
> I am getting an error -- "column "1" does not exist"
>
> Could someone point to what I am doing wrong?
>
> Bob
>
> Select 2 into point_array ;
> Select "1" into column ;

Hi Bob,

I think it is the double-quotes around the 1; just leave them out to get
a literal integer 1:

select 1 into column;

If I understand correctly, the double-quotes make Postgres look for a
column named "1".

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

Ray
I've named columns 1 through 10 so that it will be easy to determine the
next column in the loop.
When I use the following it works well.

Update library.compare
Set "1"[2] =
(select st_distance (st.............................

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2011-09-02 17:53:08 Re: Variable column name
Previous Message Raymond O'Donnell 2011-09-02 17:38:08 Re: Variable column name