Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fASM8em02744 for ; Wed, 28 Nov 2001 17:08:41 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id fASLlnR89266 for pgsql-sql@postgresql.org; Wed, 28 Nov 2001 16:47:49 -0500 (EST) (envelope-from news) From: Michael Knudsen X-Newsgroups: comp.databases.postgresql.sql Subject: Check for table existence Date: Wed, 28 Nov 2001 22:47:42 +0100 Organization: Aalborg University Lines: 25 Message-ID: <3C055B7E.BB52F0F1@but.auc.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: news@sunsite.dk X-Mailer: Mozilla 4.78 [en] (Windows NT 5.0; U) X-Accept-Language: en X-Authenticated: mk267673@but.auc.dk To: pgsql-sql@postgresql.org X-Archive-Number: 200111/406 X-Sequence-Number: 5788 Hi group First, let me say that I am new to postgres. I used MySQL before, but.. ehm.. I am trying to do a small program (in C), and I have stumbled on to some problems: 1. How can I check if a given table exists? 2. How can I check if a given existing table has the right layout? (Correct column names and types) Currently, I check using something like: select * from giventable limit 0; but that only helps checking if the table exists and if the number of columns is correct. I'm sure, there must be a smoother way to do this, but I cannot seem to find it. Anyone out there with good ideas? M. -- Rumour is information distilled so finely that it can filter through anything. -- (Terry Pratchett, Feet of Clay)