You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Collin Peters <ca...@gmail.com> on 2007/07/20 04:24:37 UTC

Usage of reserved words using PostgreSQL

I am wondering how to do the following:

I have a table that has some locales in it:

CREATE TABLE i18n
(
  i18n_id serial NOT NULL,
  identifier character varying(50) NOT NULL,
  "en_US" text NOT NULL,
  "en_CA" text,
etc...

In PostgreSQL for some reason these appear as reserved words so it
puts double-quotes around them automatically.  To run a select it
looks like:
SELECT identifier, "en_US"
FROM i18n

What is the correct syntax to use with iBatis in order to substitute
in a language?  So something like:
SELECT i18n_id, "en_US", "#language#" FROM i18n

That syntax gives me a strange error "The column index is out of
range: 1, number of columns: 0"

Collin

Re: Usage of reserved words using PostgreSQL

Posted by Larry Meadors <lm...@apache.org>.
$variable$ will do it.

On 7/19/07, Collin Peters <ca...@gmail.com> wrote:
> I am wondering how to do the following:
>
> I have a table that has some locales in it:
>
> CREATE TABLE i18n
> (
>   i18n_id serial NOT NULL,
>   identifier character varying(50) NOT NULL,
>   "en_US" text NOT NULL,
>   "en_CA" text,
> etc...
>
> In PostgreSQL for some reason these appear as reserved words so it
> puts double-quotes around them automatically.  To run a select it
> looks like:
> SELECT identifier, "en_US"
> FROM i18n
>
> What is the correct syntax to use with iBatis in order to substitute
> in a language?  So something like:
> SELECT i18n_id, "en_US", "#language#" FROM i18n
>
> That syntax gives me a strange error "The column index is out of
> range: 1, number of columns: 0"
>
> Collin
>