pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: test the existence of a database
4+ messages / 4 participants
[nested] [flat]
* Re: test the existence of a database
@ 2002-02-01 13:29 Steve Brett <steve.brett@e-mis.com>
2 siblings, 0 replies; 4+ messages in thread
From: Steve Brett @ 2002-02-01 13:29 UTC (permalink / raw)
To: pgsql-sql
psql -l
will list the databases.
psql <database name> will give to access to the command line sql environment
and once you're in there /dt will list the tables ...
Steve
"D'laila Pereira" <dpereira@students.uiuc.edu> wrote in message
news:Pine.GSO.4.31.0201311451080.6396-100000@ux11.cso.uiuc.edu...
>
> After a database is created in postgresql using the createdb command,
> and populate it with some taqbles, how do we test the existence of the
> database and the tables within it?
>
> thanks
> d'laila
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: test the existence of a database
@ 2002-02-02 16:38 Steve Boyle (Roselink) <boylesa@roselink.co.uk>
2 siblings, 0 replies; 4+ messages in thread
From: Steve Boyle \(Roselink\) @ 2002-02-02 16:38 UTC (permalink / raw)
To: D'laila Pereira <dpereira@students.uiuc.edu>; pgsql-sql
D'laila,
you could write a function in plpgsql that queried the postgres catalogues
for the object that you were interested in an returned true of false if the
object existed.
For an example see:
http://www.brasileiro.net/postgres/cookbook/view-one-recipe.adp?recipe_id=14
23
hih
steve boyle
----- Original Message -----
From: "D'laila Pereira" <dpereira@students.uiuc.edu>
To: <pgsql-sql@postgresql.org>
Sent: Thursday, January 31, 2002 8:52 PM
Subject: [SQL] test the existence of a database
>
> After a database is created in postgresql using the createdb command,
> and populate it with some taqbles, how do we test the existence of the
> database and the tables within it?
>
> thanks
> d'laila
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: test the existence of a database
@ 2002-02-26 08:20 Erle Czar Mantos <erle@hindang.msuiit.edu.ph>
2 siblings, 1 reply; 4+ messages in thread
From: Erle Czar Mantos @ 2002-02-26 08:20 UTC (permalink / raw)
To: D'laila Pereira <dpereira@students.uiuc.edu>; +Cc: pgsql-sql
Hello,
I do not see wat u r trying to mean? Do you want to test the
existence of a database from your code or from the standard shell?
If you want to test from your code, you can try connecting to
that database and if your connection is null, that means there
might be no database present.
Erle
>
> After a database is created in postgresql using the createdb command,
> and populate it with some taqbles, how do we test the existence of the
> database and the tables within it?
>
> thanks
> d'laila
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: test the existence of a database
@ 2002-02-26 08:40 Jerome Alet <alet@unice.fr>
parent: Erle Czar Mantos <erle@hindang.msuiit.edu.ph>
0 siblings, 0 replies; 4+ messages in thread
From: Jerome Alet @ 2002-02-26 08:40 UTC (permalink / raw)
To: Erle Czar Mantos <erle@hindang.msuiit.edu.ph>; +Cc: D'laila Pereira <dpereira@students.uiuc.edu>; pgsql-sql
On Tue, 26 Feb 2002, Erle Czar Mantos wrote:
> I do not see wat u r trying to mean? Do you want to test the
> existence of a database from your code or from the standard shell?
> If you want to test from your code, you can try connecting to
> that database and if your connection is null, that means there
> might be no database present.
alternatively, you can connect to template1 dans do a :
SELECT * FROM pg_database;
hth.
Jerome Alet - alet@unice.fr - http://cortex.unice.fr/~jerome
Fac de Medecine de Nice http://wwwmed.unice.fr
Tel: (+33) 4 93 37 76 30 Fax: (+33) 4 93 53 15 15
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-02-26 08:40 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-01 13:29 ` Steve Brett <steve.brett@e-mis.com>
2002-02-02 16:38 ` Steve Boyle (Roselink) <boylesa@roselink.co.uk>
2002-02-26 08:20 ` Erle Czar Mantos <erle@hindang.msuiit.edu.ph>
2002-02-26 08:40 ` Jerome Alet <alet@unice.fr>
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