From: | Tim Kane <tim(dot)kane(at)gmail(dot)com> |
---|---|
To: | pgsql-general General <pgsql-general(at)postgresql(dot)org> |
Subject: | psql variable interpolation with subsequent underscore |
Date: | 2013-11-08 16:08:37 |
Message-ID: | CEA2BD05.4C180%tim.kane@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
I¹m having difficulty using variable interpolation within psql, where that
variable is within a table name
Like so..
=# set YYYYMM 201310
=# select :YYYYMM;
?column?
----------
201309
(1 row)
=# alter table my_table rename to my_table_:YYYYMM_raw;
ERROR: syntax error at or near ":"
LINE 1: my_table rename to my_table_:YYYYMM_ra...
^
The problem is that psql tries to interpret YYYYMM_raw¹ as the variable
name, but my intention is to only interpret YYYYMM¹ followed by a literal
underscore.
I can¹t find any other way to encapsulate the variable name in this way Is
there a trick to it?
I suspect I¹ll need to work around this by altering the naming convention
such that the YYYYMM is at the end¹ of the table name. Maybe.. Thoughts?
Tim
From | Date | Subject | |
---|---|---|---|
Next Message | Rémi Cura | 2013-11-08 16:14:08 | Re: psql variable interpolation with subsequent underscore |
Previous Message | Adrian Klaver | 2013-11-08 15:29:11 | Re: Re: changing port numbers so pgbouncer can read geoserver and postgres |