pg.ddx.io pgsql-odbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
CREATE TABLE IF NOT EXIST 2+ messages / 2 participants [nested] [flat]
* CREATE TABLE IF NOT EXIST @ 2008-01-25 14:09 Mike Gagnon <mike.gagnon@bellnet.ca> 2008-01-25 15:03 ` Re: CREATE TABLE IF NOT EXIST Obe, Regina <robe.dnd@cityofboston.gov> 0 siblings, 1 reply; 2+ messages in thread From: Mike Gagnon @ 2008-01-25 14:09 UTC (permalink / raw) To: pgsql-odbc 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 ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: CREATE TABLE IF NOT EXIST 2008-01-25 14:09 CREATE TABLE IF NOT EXIST Mike Gagnon <mike.gagnon@bellnet.ca> @ 2008-01-25 15:03 ` Obe, Regina <robe.dnd@cityofboston.gov> 0 siblings, 0 replies; 2+ messages in thread From: Obe, Regina @ 2008-01-25 15:03 UTC (permalink / raw) To: Mike Gagnon <mike.gagnon@bellnet.ca>; 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. ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2008-01-25 15:03 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2008-01-25 14:09 CREATE TABLE IF NOT EXIST Mike Gagnon <mike.gagnon@bellnet.ca> 2008-01-25 15:03 ` Obe, Regina <robe.dnd@cityofboston.gov>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox