Received: from ural2.hszk.bme.hu (ural2.hszk.bme.hu [152.66.130.2]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f8J0cxd20084 for ; Tue, 18 Sep 2001 20:38:59 -0400 (EDT) (envelope-from kb136@hszk.bme.hu) Received: (from kb136@localhost) by ural2.hszk.bme.hu (8.11.3/8.11.3) id f8IEfUe02871; Tue, 18 Sep 2001 16:41:30 +0200 (MEST) Date: Tue, 18 Sep 2001 16:41:30 +0200 (MEST) From: Kovacs Baldvin X-X-Sender: To: Josh Berkus cc: Julester , Subject: Re: Checking for table existence In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by postgresql.org id f8J0d0d20086 X-Archive-Number: 200109/136 X-Sequence-Number: 4808 > > CREATE FUNCTION my_function ( ... > > .... > IF NOT table_exists(''my_table'') THEN > CREATE TABLE ... > END IF; > .... > > > Got the idea? Not bad... Well, I am not the person questioned... But let me share a few ideas about it. The solution what I gave was a "more SQL way" of doing it. So after creating the function qexec, you could write a long file, x.sql, like ... sql blabla... ... sql blabla... CASE WHEN ...the table not exests... THEN qexec('the creator sql command') END; ... sql blabla... My experience is this is a quite universal style, if a company would like to create an sql-database structure for a certain job. Your solution is also based on functions, so the realization is quite similar. But you have either write a function for every table creation, or write an intelligent function, which gets HOW to create WHAT table... My first idea was something like this, but later I thougth it is "politically more correct" if I use only a very universal function, what I called qexec. Moreover, I can imagine that I would see happily this sql-executor function in the base distribution, not only int the documentation, as an example. It is quite a good example... However, your solution is naturally a good and usable solution, please do not treat this letter as an offensive letter. I only tried to argue a bit for my way of thinking... Thanks for reading this, if you reached this pont, :-)) Regads, Baldvin > > -Josh > > > > ______AGLIO DATABASE SOLUTIONS___________________________ > Josh Berkus > Complete information technology josh@agliodbs.com > and data management solutions (415) 565-7293 > for law firms, small businesses fax 621-2533 > and non-profit organizations. San Francisco > Üdv, Baldvin