Обсуждение: Query changes

Поиск
Список
Период
Сортировка

Query changes

От
Tapan Trivedi
Дата:
Hi all:

I have started using postgreSQL for our internal systems which were
running on MS SQL.

I have a problem which I faced for my first cut tests on migration.

My internal systems are developed using ASP and Java. While, I could
access the database in postgreSQL, I have to pass the table names as
"table_name" for all queries (in quotes). Is there something I have
missed during the setup ?

I do not want to think about getting into the code and changing all the
queries :-(

Any help will be appreciated.

Thanks in advance.

Re Tapan


Re: Query changes

От
Martijn van Oosterhout
Дата:
On Thu, May 15, 2003 at 05:30:56PM +0530, Tapan Trivedi wrote:
> Hi all:
>
> I have started using postgreSQL for our internal systems which were
> running on MS SQL.
>
> I have a problem which I faced for my first cut tests on migration.
>
> My internal systems are developed using ASP and Java. While, I could
> access the database in postgreSQL, I have to pass the table names as
> "table_name" for all queries (in quotes). Is there something I have
> missed during the setup ?
>
> I do not want to think about getting into the code and changing all the
> queries :-(

If you use quotes it preserve case. So, if you use quotes when you create
the table, you may need quotes when you access the table. OTOH if you don't
use quotes when you create the table, you won't need them in the queries
either. Example:

create table HelloWorld (...);
select * from HelloWorld;     <-- WORKS
select * from helloworld;     <-- WORKS

create table "HelloWorld" (...);
select * from "HelloWorld";       <-- WORKS
select * from HelloWorld;         <-- FAILS
select * from helloworld;         <-- FAILS

Hope this helps,

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
>   - Samuel P. Huntington

Вложения