Re: [GENERAL] Switch database inside psql?

Поиск
Список
Период
Сортировка
От Maarten Boekhold
Тема Re: [GENERAL] Switch database inside psql?
Дата
Msg-id Pine.SUN.3.91.980807110900.13396B-100000@dutepp2.et.tudelft.nl
обсуждение исходный текст
Ответ на Switch database inside psql?  (lynch@lscorp.com (Richard Lynch))
Ответы Re: [GENERAL] Switch database inside psql?  (Tom Good <tomg@nrnet.org>)
Список pgsql-general
On Thu, 6 Aug 1998, Richard Lynch wrote:

> I'd like to have a single file.sql that will create the same database and
> some tables on several different systems.  Is it possible to 'switch' to a
> different database after one does the create database?  So that tables
> created would go in the new database and not template1?  Or does this
> already happen and is just not documented?...  I'd be guessing a big no on
> the latter, since the psql prompt still says 'template1' after I create a
> database...

use '\connect database name' from witnin psql. Maybe you have to include a
username, don't know.

> I get an error message when I try createdb from the command line, but once

Probably because of authentication problems. You can set the PGUSER and
PGPASSWORD environment variables to use authentication always (ie. you
don;t have to specify a '-u' switch anymore).

> I've done psql -u, I can do it, so I guess if I had to do this from some
> sort of Perl/sed/awk/??? script (none of which I could write anyway), I'd
> need to know how to convince createdb that I *am* a valid database-creator,
> by golly.

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems  |
|                   Department of Electrical Engineering                    |
|           Computer Architecture and Digital Technique section             |
|                          M.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------


В списке pgsql-general по дате отправления:

Предыдущее
От: "R.Stevens"
Дата:
Сообщение: Design
Следующее
От: Tom Good
Дата:
Сообщение: Re: [GENERAL] Switch database inside psql?