Re: ODBC driver and non case-insensitivity?

From: Joel Burton <joel(at)joelburton(dot)com>
To: Chris Storah <cstorah(at)emis-support(dot)demon(dot)co(dot)uk>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ODBC driver and non case-insensitivity?
Date: 2001-10-19 20:33:25
Message-ID: Pine.LNX.4.30.0110191628570.22474-100000@temp.joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 19 Oct 2001, Chris Storah wrote:

> Just searched the archives but no match for this problem that I can see:
>
> Exporting an MS SQL 2000 table to PostgreSQL 7.1.3 fails due to uppercase
> table names.
>
> MS SQL is set to quote all identifiers so the queries are sent in the format:
> 'create table TEST(ABC int)'
> However, when MS SQL sends a query 'select * from test', the ODBC fails with
> "ERROR: Relation 'test' does not exist" as it is looking for the lowercase
> version of the table.
>
> Through psql, the uppercase table names are converted into lowercase so
> PostgreSQL seems to be okay. Is this a problem with the ODBC driver?
>
> If so, are there any patches available?

How are you "exporting" a MS SQL table to PG? If this is a dump utility in
MS SQL, there may be an option in this dumping program to not quote
identifiers (table names, etc.) to be uppercase.

However, if the dumping program is dumping with quoted uppercase
identifers, it's not a bug that PG doesn't find the table: "TEST" is a
different table than "test". This is not an ODBC problem at all, if I
understand your problem.

Unquoted identifiers, eg test (no quotes) is sent as uppercase regardless
of how you write it: test Test teST; if written w/quotes, case is
preserved.

If the MSSQL dump routine can't ditch the quoted identifiers, you could
either (a) search/replace/sed/perl/whatever the quotes out of the SQL dump
before importing to PG, or (b) once in PG, ALTER TABLE "FOO" RENAME TO
"foo".

(b) is tricky, though, as index names and ref integrity constraints and
such aren't corrected for this. (a) is a better solution.

HTH,
--

Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2001-10-20 01:28:27 Bug #488: Apache daemon dying on segfault from postgres
Previous Message Andras Belokosztolszki 2001-10-19 18:47:38 triggers with parameters can cause backend crash