Re: C++Builder table exist - Mailing list pgsql-general

From Jasen Betts
Subject Re: C++Builder table exist
Date
Msg-id ki12o1$bub$1@gonzo.reversiblemaps.ath.cx
Whole thread Raw
In response to C++Builder table exist  (Charl Roux <charl.roux@hotmail.com>)
Responses Re: C++Builder table exist
List pgsql-general
On 2013-03-13, Charl Roux <charl.roux@hotmail.com> wrote:
> --_51d77859-0e03-4afa-bde6-853bee9c0a11_
> Content-Type: text/plain; charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

appologies for the formatting, gmane did something to your email that
SLRN didn't like.

> void __fastcall TfrmMain::FormCreate(TObject *Sender)
> {
>   int errorCode;
>   TStringList *tableList = new TStringList;
>   frmDataModule->eyeConnection->GetTableNames(tableList);
>
>   // create queryBackup table if does not exist
>   AnsiString SQL = "CREATE TABLE queryBackup( queryName VARCHAR(30) PRIMARY KEY ,query VARCHAR(10000))";
>   if( tableList->IndexOf("queryBackup") < 0 )
>     errorCode = frmDataModule->eyeConnection->ExecuteDirect(SQL);
> }

> ERROR: relation "querybackup" already exists.

The problem is you're checking for queryBackup and then creating
querybackup when it doesn't exist. (note: capitalisation)

http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html

This case-folding is one of the few places where postgres deliberately
breaks the sql standard (AIUI standard wants case folded upwards).

--
⚂⚃ 100% natural

pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Re: Addled index
Next
From: Jasen Betts
Date:
Subject: Re: DB design advice: lots of small tables?