pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Create tables in one query
3+ messages / 3 participants
[nested] [flat]

* Create tables in one query
@ 2000-11-23 14:02 Tomasz Gralewski <tg@bhv.pl>
  2000-11-23 16:40 ` Re: Create tables in one query bmccoy@chapelperilous.net
  0 siblings, 1 reply; 3+ messages in thread

From: Tomasz Gralewski @ 2000-11-23 14:02 UTC (permalink / raw)
  To: pgsql-sql

Hello,
Tomasz Gralewski

I'd like to create a few tables in one SQL query, is that possible.
What tools I have to use, Perl, Tcl, or maybe is there block command
separator that I can write:
CREATE TABLE abd
 (
    a    type,
    b    type,
    c    type
 ) and I whant to add the next table here, how can I separate, by this (";"
that;s the end of table abd).

Thank You in advance.
Tomasz




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Create tables in one query
  2000-11-23 14:02 Create tables in one query Tomasz Gralewski <tg@bhv.pl>
@ 2000-11-23 16:40 ` bmccoy@chapelperilous.net
  2000-11-23 17:28   ` Re: Create tables in one query Albert REINER <areiner@tph.tuwien.ac.at>
  0 siblings, 1 reply; 3+ messages in thread

From: bmccoy@chapelperilous.net @ 2000-11-23 16:40 UTC (permalink / raw)
  To: Tomasz Gralewski <tg@bhv.pl>; +Cc: pgsql-sql

On Thu, 23 Nov 2000, Tomasz Gralewski wrote:

> I'd like to create a few tables in one SQL query, is that possible.
> What tools I have to use, Perl, Tcl, or maybe is there block command
> separator that I can write:
> CREATE TABLE abd
>  (
>     a    type,
>     b    type,
>     c    type
>  ) and I whant to add the next table here, how can I separate, by this (";"
> that;s the end of table abd).

Not sure what you are trying to do here.  You can put statements like

CREATE TABLE (
...
);

CREATE TABLE (
...
);

CREATE INDEX ... ;
GRANT SELECT... ;

in a single file and load the file into psql via \i.  That's I build all
of my databases.

Brett W. McCoy
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
A bachelor is a selfish, undeserving guy who has cheated some woman out
of a divorce.
		-- Don Quinn




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Create tables in one query
  2000-11-23 14:02 Create tables in one query Tomasz Gralewski <tg@bhv.pl>
  2000-11-23 16:40 ` Re: Create tables in one query bmccoy@chapelperilous.net
@ 2000-11-23 17:28   ` Albert REINER <areiner@tph.tuwien.ac.at>
  0 siblings, 0 replies; 3+ messages in thread

From: Albert REINER @ 2000-11-23 17:28 UTC (permalink / raw)
  To: pgsql-sql

On Thu, Nov 23, 2000 at 11:40:52AM -0500, bmccoy@chapelperilous.net wrote:
> On Thu, 23 Nov 2000, Tomasz Gralewski wrote:
> 
> > I'd like to create a few tables in one SQL query, is that possible.
> > What tools I have to use, Perl, Tcl, or maybe is there block command
> > separator that I can write:
> > CREATE TABLE abd
> >  (
> >     a    type,
> >     b    type,
> >     c    type
> >  ) and I whant to add the next table here, how can I separate, by this (";"
> > that;s the end of table abd).
> 
> Not sure what you are trying to do here.  You can put statements like
...
> in a single file and load the file into psql via \i.  That's I build all
> of my databases.

Or, if you are concerned with possible failures: enclose the series of
CREATEs in a transaction.

Albert.


-- 

--------------------------------------------------------------------------
Albert Reiner                                   <areiner@tph.tuwien.ac.at>
Deutsch       *       English       *       Esperanto       *       Latine
--------------------------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-11-23 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-23 14:02 Create tables in one query Tomasz Gralewski <tg@bhv.pl>
2000-11-23 16:40 ` bmccoy@chapelperilous.net
2000-11-23 17:28   ` Albert REINER <areiner@tph.tuwien.ac.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox