Обсуждение: character limit on db names in PGSQL or what?
had a db named: prysm_shreveport
with one table named 'shreveport'
came back later and did:
createdb prysm_shreveport2
psql -e prysm_shreveport2 < shreveport2.sql --> which creates table
'shreveport2'
then:
psql prysm_shreveport2
which to my suprise had 2 tables! shreveport, and shreveport2
So I started with:
createdb prysm_shreveport3
psql prysm_shreveport3
suprise, suprise, it already has two tables in it, shreveoprt, and
shreveport2
so what I can tell
createdb prysm_shreveport3 (does in deed create a new database, that I can
see by doing: psql then \l to list all dbs)
destroydb prysm_shreveport3 will actually delete the database.
but to do something like
psql prysm_shreveport3 doesn't actually connect me to that database
it actually connects me to prysm_shreveport even though my command line
looks like this in psql: prysm_shreveport3=>
even if there is no database listed as prysm_shreveport2
I can do: psql prysm_shreveort2
and it looks and acts as though I'm connected to prysm_shreveport2 when
actually it's prysm_shreveport that I'm connected to.
I'm thinking an error message somewhere along the line or something would
have been nice, and fortunately no data was lost in this process, very
easily could have been however.
currently running postgres 6.3.x I've got 6.4.x running at home, I was
going to try it there too, just to see what happens. I just thought this
was strange.
Kevin
--------------------------------------------------------------------
Kevin Heflin | ShreveNet, Inc. | Ph:318.222.2638 x103
VP/Mac Tech | 333 Texas St #619 | FAX:318.221.6612
kheflin@shreve.net | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------
Kevin - Seems to be fixed w/ 6.4.2: $ createdb createdb prysm_shreveport $ createdb createdb prysm_shreveport2 $ psql prysm_shreveport Welcome to the POSTGRESQL interactive sql monitor: Please read the file COPYRIGHT for copyright terms of POSTGRESQL type \? for help on slash commands type \q to quit type \g or terminate with semicolon to execute query You are currently connected to the database: prysm_shreveport prysm_shreveport=> \d Couldn't find any tables, sequences or indices! prysm_shreveport=> create table test (f int, g text); CREATE prysm_shreveport=> \c prysm_shreveport2 connecting to new database: prysm_shreveport2 prysm_shreveport2=> \d Couldn't find any tables, sequences or indices! prysm_shreveport2=> create table test2 (f int, g text); CREATE prysm_shreveport2=> \d Database = prysm_shreveport2 +------------------+----------------------------------+----------+ | Owner | Relation | Type | +------------------+----------------------------------+----------+ | reedstrm | test2 | table | +------------------+----------------------------------+----------+ prysm_shreveport2=> \c prysm_shreveport connecting to new database: prysm_shreveport prysm_shreveport=> \d Database = prysm_shreveport +------------------+----------------------------------+----------+ | Owner | Relation | Type | +------------------+----------------------------------+----------+ | reedstrm | test | table | +------------------+----------------------------------+----------+ prysm_shreveport=> \c prysm_shreveport3 connecting to new database: prysm_shreveport3 FATAL 1: Database prysm_shreveport3 does not exist in pg_database Could not connect to new database. exiting $ Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005