Re: Variable column name

From: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
To: "Bill Moran" <wmoran(at)potentialtech(dot)com>
Cc: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Variable column name
Date: 2011-09-02 20:31:32
Message-ID: 66A47B44AA384A5C8CD9FD4A32F55986@BobPC
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)shaw(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Ribe 2011-09-02 20:51:52 Re: Variable column name
Previous Message Devrim GÜNDÜZ 2011-09-02 19:31:25 Re: pgAdmin3 not working with Gnome3