Re: CREATE TABLE IF NOT EXIST - Mailing list pgsql-odbc

From Obe, Regina
Subject Re: CREATE TABLE IF NOT EXIST
Date
Msg-id 53F9CF533E1AA14EA1F8C5C08ABC08D20316E557@ZDND.DND.boston.cob
Whole thread Raw
In response to CREATE TABLE IF NOT EXIST  ("Mike Gagnon" <mike.gagnon@bellnet.ca>)
List pgsql-odbc
IF NOT EXISTS(SELECT tablename FROM pg_catalog.pg_tables WHERE tablename = 'mytable')
 
....
 
 
IF NOT EXISTS(SELECT table_name FROM information_schema.tables where table_name = 'mytable')
 
Maybe the problem you are having is a permissions problem though.  Are you using the same account in psql as you are in ODBC?
 
Hope that helps,
Regina


From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mike Gagnon
Sent: Friday, January 25, 2008 9:09 AM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] CREATE TABLE IF NOT EXIST

Hi Postgres Experts,
 
I'm trying to create tables (if they don't exist) through the ODBC driver.  I've tried the following:
 
SELECT relname FROM pg_class  WHERE relname = 'mytable';
 
This works from the psql command line program when logged into my database, but not when connected to my database over ODBC ( I get SQL_NO_DATA back from SQLFetch)
 
Any ideas?  Are there other ways to find out if a table exists?
 
Many thanks,
Mike


The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.


Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper.

pgsql-odbc by date:

Previous
From: Lathrop_Steve@emc.com
Date:
Subject: Building ODBC driver issue
Next
From: "Hiroshi Saito"
Date:
Subject: Re: Building ODBC driver issue