Hi .. I have not been able to work out how to do this is Postgres 8 (pseudo-code) if exists table foo drop table foo; end create table foo; If I go with drop table foo; create table foo; then it barfs on an empty db. I can find the table name in pg_class but I am not sure of where to go from there. The assumption here is that the SQL is coming in on a script via the programmatic interface. Slurp in a bunch of SQL commands and then fire them at the database. Perhaps it is just easier to 'dropdb' then 'createdb' and go from there. Many thanks, -- -mark. (probertm at acm dot org) ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org