Are SQL queries locale dependent?

From: Martin Schäfer <Martin(dot)Schaefer(at)cadcorp(dot)com>
To: <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Are SQL queries locale dependent?
Date: 2005-02-25 09:41:03
Message-ID: AA31868BC8CE1B4DB132141A6556A20A8D90@dev010_ex.Dev.cadcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi,

I recently found out that my app doesn't work in Spain because it creates localized queries like this:

create table t (c1 float8, c2 float8);
insert into t (c1, c2) values (3,14159, 1,4142);

I understand that PostgreSQL obviously can't parse this query. But I'm not sure how to fix this query so that it works under all circumstances.

If the database uses the "C" (or e.g. English or US) locale, then I know that I always have to use the decimal dot ('.') instead of a decimal comma (','), regardless of the locale of the client machine.

But what if the database itself uses a locale which mandates a decimal comma, like Spanish, German, etc.? How do I have to construct the SQL query then?

Martin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aleksei Valikov 2005-02-25 09:41:29 Re: Problems with query in highly concurrent environment
Previous Message Richard Huxton 2005-02-25 09:28:23 Re: Which query is less expensive / faster?

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-02-25 15:51:53 Re: Are SQL queries locale dependent?
Previous Message KÖPFERL Robert 2005-02-25 08:33:32 Re: Junk queries with variables?