From: | "Obe, Regina" <robe(dot)dnd(at)cityofboston(dot)gov> |
---|---|
To: | "Mike Gagnon" <mike(dot)gagnon(at)bellnet(dot)ca>, <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Re: CREATE TABLE IF NOT EXIST |
Date: | 2008-01-25 15:03:48 |
Message-ID: | 53F9CF533E1AA14EA1F8C5C08ABC08D20316E557@ZDND.DND.boston.cob |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org
[mailto:pgsql-odbc-owner(at)postgresql(dot)org] On Behalf Of Mike Gagnon
Sent: Friday, January 25, 2008 9:09 AM
To: pgsql-odbc(at)postgresql(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Saito | 2008-01-25 16:15:36 | Re: Building ODBC driver issue |
Previous Message | Lathrop_Steve | 2008-01-25 14:42:31 | Building ODBC driver issue |