X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8B8B4D1B4B6 for ; Tue, 30 Mar 2004 21:40:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06134-03 for ; Tue, 30 Mar 2004 17:40:10 -0400 (AST) Received: from conexa.fciencias.unam.mx (conexa.fciencias.unam.mx [132.248.181.120]) by svr1.postgresql.org (Postfix) with ESMTP id 35BC9D1E7EE for ; Tue, 30 Mar 2004 17:40:06 -0400 (AST) Received: from conexa.fciencias.unam.mx (conexa.fciencias.unam.mx [127.0.0.1]) by conexa.fciencias.unam.mx (8.12.8/8.12.8) with ESMTP id i2ULX3K3018512; Tue, 30 Mar 2004 15:33:03 -0600 Received: (from masm@localhost) by conexa.fciencias.unam.mx (8.12.8/8.12.8/Submit) id i2ULX3mT018510; Tue, 30 Mar 2004 15:33:03 -0600 X-Authentication-Warning: conexa.fciencias.unam.mx: masm set sender to masm@fciencias.unam.mx using -f To: Ben Kim Cc: pgsql-admin@postgresql.org Subject: Re: tweaking scan.l References: In-Reply-To: Message-ID: From: Manuel Sugawara User-Name: Manuel Sugawara User-Mail-Address: masm@fciencias.unam.mx Date: 30 Mar 2004 15:33:03 -0600 Lines: 28 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Portable Code) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/394 X-Sequence-Number: 12963 --=-=-= Ben Kim writes: > Manuel Sugawara 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=scan.patch *** 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; } {xddouble} { --- 408,414 ---- literalbuf[len] = '\0'; literallen = len; } ! yylval.str = litbufdup_lower(); return IDENT; } {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) --=-=-= Regards, Manuel. --=-=-=--