Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id F217F63284D for ; Sun, 15 Nov 2009 23:02:48 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 02659-02 for ; Mon, 16 Nov 2009 03:02:11 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id 8B09863298C for ; Sun, 15 Nov 2009 23:02:25 -0400 (AST) Received: from localhost (access [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 70E9A1E0443; Mon, 16 Nov 2009 11:02:21 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (access.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xd-PO66kMocj; Mon, 16 Nov 2009 11:02:19 +0800 (WST) Received: from [10.1.1.6] (124-169-36-119.dyn.iinet.net.au [124.169.36.119]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 94BC51E043F; Mon, 16 Nov 2009 11:02:19 +0800 (WST) Message-ID: <4B00C0B7.2060406@postnewspapers.com.au> Date: Mon, 16 Nov 2009 11:02:15 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.1) Gecko/20090715 Thunderbird/3.0b3 MIME-Version: 1.0 To: ikorot@earthlink.net CC: pgsql-odbc@postgresql.org Subject: Re: Table creation References: <26627023.1258337329909.JavaMail.root@elwamui-hybrid.atl.sa.earthlink.net> In-Reply-To: <26627023.1258337329909.JavaMail.root@elwamui-hybrid.atl.sa.earthlink.net> X-Enigmail-Version: 0.97a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.449 tagged_above=-10 required=5 tests=AWL=-0.709, BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 200911/11 X-Sequence-Number: 10060 On 16/11/2009 10:08 AM, ikorot@earthlink.net wrote: > Hi, ALL, > I'm new to this list and to PostgreSQL. However, I am > a C++ developer with some ODBC development experience. > > I heard that in PostgreSQL it is possible to create table > in 2 ways: > > CREATE TABLE "Foo" ....; > > CREATE TABLE Foo... ; > > So, when using unquoted version all query should check for > the case sensitivity. > > Is it possible to check how the table was created to use proper > query syntax? If the unquoted form was used, the table name will have been downcased by PostgreSQL. It's still case sensitive, just forced to lower case. Essentially, CREATE TABLE Foo ... ; is exactly equivalent to: CREATE TABLE "foo" ... ; in terms of its effects after the CREATE statement has executed. So, if you expect to have any non-lower-case identifiers (table names, index names, constraint names, etc) in your database, ALWAYS quote your identifiers. If they're all lower case, it'll still work. The only problem that'll arise is if your application is told by some external source to access table "Foo" but doesn't know if the external source created it as "Foo" or "foo". In that case, you can either query INFORMATION_SCHEMA with a case-insensitive search to find the table (which is slow and ugly) or just fix your app to be consistent about quoting and case. -- Craig Ringer