From: Manuel Sugawara <masm@fciencias.unam.mx>
To: Ben Kim <bkim@coe.tamu.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: tweaking scan.l
Date: 30 Mar 2004 15:33:03 -0600
Message-ID: <m3isgmvxut.fsf@conexa.fciencias.unam.mx> (raw)
In-Reply-To: <Pine.GSO.4.10.10403301106140.29968-100000@edsun.coe.tamu.edu>
References: <Pine.GSO.4.10.10403301106140.29968-100000@edsun.coe.tamu.edu>
> Manuel Sugawara <masm ( at ) fciencias ( dot ) unam ( dot ) mx> wrote:
> >> Is there a way to completely turn off case sensitivity of the names
> >> of table, field, sequence, etc.?
> >No, i'm afraid not. But you can tweak scan.l to teach postgreSQL do
> >what you want.
>
> Many thanks. I want to ask a few questions, if you don't mind.
Ok, here is what I would do if I were facing your problem:
1.- Be sure that each identifier in the database catalogs doesn't
require the double quotes, for instance, for pg_class do something
like:
update pg_class set relname = lower(relname) where relname <> lower(relname);
Do the same for pg_namespace, pg_attribute, etc.
2.- Teach scan.l to treat "Identifier" just as identifier, the
following patch against 7.3 will do the work
Regards,
Manuel.
Attachments:scan.patch (text/x-patch, 906B) download
*** scan.l~ 2002-11-10 21:33:44.000000000 -0600
--- scan.l 2004-03-30 15:36:23.000000000 -0600
***************
*** 408,414 ****
literalbuf[len] = '\0';
literallen = len;
}
! yylval.str = litbufdup();
return IDENT;
}
<xd>{xddouble} {
--- 408,414 ----
literalbuf[len] = '\0';
literallen = len;
}
! yylval.str = litbufdup_lower();
return IDENT;
}
<xd>{xddouble} {
***************
*** 670,675 ****
--- 670,691 ----
return new;
}
+ static char *+ litbufdup_lower(void)+ {+ char *new;+ int i;+ + new = palloc(literallen + 1);+ memcpy(new, literalbuf, literallen+1);+ + for(i = 0; x < literallen; x++)+ if (isupper((unsigned char) *(new + i))+ *(new + i) = tolower((unsigned char) *(new + i));+ + return new;+ }+
unsigned char
unescape_single_char(unsigned char c)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: masm@fciencias.unam.mx, bkim@coe.tamu.edu
Subject: Re: tweaking scan.l
In-Reply-To: <m3isgmvxut.fsf@conexa.fciencias.unam.mx>
References: <Pine.GSO.4.10.10403301106140.29968-100000@edsun.coe.tamu.edu> <m3isgmvxut.fsf@conexa.fciencias.unam.mx>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox