Search Postgresql Archives

create table if does not exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I try to have the following stored procedure, to help me create tables, if the table does not exists (Is this a good practice by the way?)


if not exists(select * from information_schema.tables where table_name = 'MYTABLE') then

RAISE NOTICE 'table not there yet.';

CREATE TABLE MYTABLE
(
  "value" text NOT NULL
);

end if;


When I run for the 2nd time, 'table not there yet.' still being printed out, al though I check through pgadmin, the MYTABLE is there.

May I know how I can fix this?

Thanks and Regards
Yan Cheng CHEOK


      


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux