Re: Variable column name - Mailing list pgsql-general

From Bob Pawley
Subject Re: Variable column name
Date
Msg-id 66A47B44AA384A5C8CD9FD4A32F55986@BobPC
Whole thread Raw
In response to Re: Variable column name  (Bill Moran <wmoran@potentialtech.com>)
Responses Re: Variable column name
List pgsql-general

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

In response to "Bob Pawley" <rjpawley@shaw.ca>:
>
> I am getting an error  -- "column "1" does not exist"

<snip>

>     Select "1" into column ;

Where are you selecting "1" from?  This query has no FROM clause, so of
course the column doesn't exist.

The previous query, "SELECT 2 INTO point_array" is going to put the
integer value 2 into the variable point_array, which I'm guessing is
not what you want either.


Well, actually that is what I am attempting.

I added the from clause and that seems to be acceptable for the column
identification.

What I am trying to accomplish is to collect distance information between
numerous geometries (in this case 8) at the first spatial location and build
an array in column 1, one array point at a time.

Then the loop moves to the next location, establishes the geometries and
updates the column 2 array with these distances.

It seems to work when I hard code the column name and array point, so I was
hoping to make it work through a loop using variables for column and array
point.

Does this make sense??

Bob


pgsql-general by date:

Previous
From: Devrim GÜNDÜZ
Date:
Subject: Re: pgAdmin3 not working with Gnome3
Next
From: Scott Ribe
Date:
Subject: Re: Variable column name