Check for table existence

From: Michael Knudsen <mk267673(at)but(dot)auc(dot)dk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Check for table existence
Date: 2001-11-28 21:47:42
Message-ID: 3C055B7E.BB52F0F1@but.auc.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2001-11-29 01:32:14 Re: PL/pgSQL loops?
Previous Message Josh Berkus 2001-11-28 21:29:14 Re: email address for questions