pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedSample database for testing?
4+ messages / 3 participants
[nested] [flat]
* Sample database for testing?
@ 2002-01-26 04:06 Andy Ruhl <acruhl@sdf.lonestar.org>
0 siblings, 1 reply; 4+ messages in thread
From: Andy Ruhl @ 2002-01-26 04:06 UTC (permalink / raw)
To: pgsql-admin
I'm new to postgresql and I was wondering if there was a "sample" database
out there I could use to practice dumping and reloading. I figure I should
get good at recovery and administration before I actually use it... I
don't have a database to do these kinds of things with and I'd rather not
write one just so I can hose it...
Thanks.
Andy
acruhl@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Sample database for testing?
@ 2002-02-01 20:26 bangh <banghe@baileylink.net>
parent: Andy Ruhl <acruhl@sdf.lonestar.org>
0 siblings, 1 reply; 4+ messages in thread
From: bangh @ 2002-02-01 20:26 UTC (permalink / raw)
To: Andy Ruhl <acruhl@sdf.lonestar.org>; +Cc: pgsql-admin
There is a database template1 you can play with.
If there is no table in template1, you can create one by:
psql template1
psql> create table mytable (
psql> mydate datetime,
psql> mymem text);
psql> insert into mytable values('now', 'I am doing this today');
psql> select * from mytable;
psql>\q;
dump your database:
pg_dump template1 > mydump.pgdump
create another copy of this database:
createdb newdatabase
cat mydump.pgdump | psql newdatabase
have a look at your new database
psql newdatabase
psql>\d;
psql>select * from mytable;
(add a new column)
psql>alter table mytable add column priority text;
psql>insert into mytable values('now', 'Always play at first, then ...',
'super high');
psql>select * from mytable;
psql>\q;
Have a lot of fun!
Banghe
Andy Ruhl wrote:
> I'm new to postgresql and I was wondering if there was a "sample" database
> out there I could use to practice dumping and reloading. I figure I should
> get good at recovery and administration before I actually use it... I
> don't have a database to do these kinds of things with and I'd rather not
> write one just so I can hose it...
>
> Thanks.
>
> Andy
>
> acruhl@sdf.lonestar.org
> SDF Public Access UNIX System - http://sdf.lonestar.org
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Sample database for testing?
@ 2002-02-01 21:19 Oliver Elphick <olly@lfix.co.uk>
parent: bangh <banghe@baileylink.net>
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Elphick @ 2002-02-01 21:19 UTC (permalink / raw)
To: bangh <banghe@baileylink.net>; +Cc: Andy Ruhl <acruhl@sdf.lonestar.org>; pgsql-admin
On Fri, 2002-02-01 at 20:26, bangh wrote:
> There is a database template1 you can play with.
>
> If there is no table in template1, you can create one by:
>
> psql template1
> psql> create table mytable (
> psql> mydate datetime,
> psql> mymem text);
> psql> insert into mytable values('now', 'I am doing this today');
> psql> select * from mytable;
> psql>\q;
If you do this, you will have mytable in every database you create
thereafter. It is not called a template for no reason! template1 is
copied in its entirety into every new database when it is created. (And
so the rest of the advice is redundant, too.)
A better choice is to run the regression tests and use the regression
database for your experiments, since it will have a lot of tables
already containing data.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
"And be not conformed to this world; but be ye
transformed by the renewing of your mind, that ye may
prove what is that good, and acceptable, and perfect,
will of God." Romans 12:2
Attachments:
signature.asc (application/pgp-signature, 231B) download
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Sample database for testing?
@ 2002-02-01 23:01 Andy Ruhl <acruhl@sdf.lonestar.org>
parent: Oliver Elphick <olly@lfix.co.uk>
0 siblings, 0 replies; 4+ messages in thread
From: Andy Ruhl @ 2002-02-01 23:01 UTC (permalink / raw)
To: Oliver Elphick <olly@lfix.co.uk>; +Cc: bangh <banghe@baileylink.net>; pgsql-admin
On 1 Feb 2002, Oliver Elphick wrote:
> If you do this, you will have mytable in every database you create
> thereafter. It is not called a template for no reason! template1 is
> copied in its entirety into every new database when it is created. (And
> so the rest of the advice is redundant, too.)
Yeah, I don't think I want to mess with template.
> A better choice is to run the regression tests and use the regression
> database for your experiments, since it will have a lot of tables
> already containing data.
I actually ordered the new Practical Postgresql book from O'Reilly. There
is a sample database in there called booktown.sql. I realize this book is
free online, but I like to support the cause...
> Isle of Wight http://www.lfix.co.uk/oliver
I gotta check this place out...
Andy
--
acruhl@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-02-01 23:01 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-01-26 04:06 Sample database for testing? Andy Ruhl <acruhl@sdf.lonestar.org>
2002-02-01 20:26 ` bangh <banghe@baileylink.net>
2002-02-01 21:19 ` Oliver Elphick <olly@lfix.co.uk>
2002-02-01 23:01 ` Andy Ruhl <acruhl@sdf.lonestar.org>
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