| From: | Scott Ribe <scott_ribe(at)elevated-dev(dot)com> |
|---|---|
| To: | Bob Pawley <rjpawley(at)shaw(dot)ca> |
| Cc: | Postgresql General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Variable column name |
| Date: | 2011-09-02 20:51:52 |
| Message-ID: | 2F809BB7-C2E1-4F75-8523-9D9CCBB4D4CB@elevated-dev.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sep 2, 2011, at 2:31 PM, Bob Pawley wrote:
> 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??
Building queries this way is tedious & error prone; that's just the way it is.
Put the command into a variable, then raise a notice with that variable, then execute it. That way, when you get a failure, you just copy the failed SQL from the notice into an editor, tweak it until it works, then adjust your code accordingly to produce the corrected query.
--
Scott Ribe
scott_ribe(at)elevated-dev(dot)com
http://www.elevated-dev.com/
(303) 722-0567 voice
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martín Marqués | 2011-09-02 22:40:53 | Re: pg_lock_status not documented |
| Previous Message | Bob Pawley | 2011-09-02 20:31:32 | Re: Variable column name |