Discussion:
Syntax question
(too old to reply)
Jeff Stout
2004-06-07 21:18:48 UTC
Permalink
I am fairly new to postgres, I need to know how to switch
databases once I'm in a psql session. I can't seem to find the
command for \h , maybe I just blind |-;

Thank you in advance

Jeff Stout


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Scott Marlowe
2004-06-07 21:35:55 UTC
Permalink
Post by Jeff Stout
I am fairly new to postgres, I need to know how to switch
databases once I'm in a psql session. I can't seem to find the
command for \h , maybe I just blind |-;
\c database


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ***@postgresql.org
Jim Seymour
2004-06-07 21:47:43 UTC
Permalink
Post by Jeff Stout
I am fairly new to postgres, I need to know how to switch
databases once I'm in a psql session. I can't seem to find the
command for \h , maybe I just blind |-;
"\?" is your friend...

$ psql
Password:
Welcome to psql 7.4.2, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

jseymour=> \?
General
\c[onnect] [DBNAME|- [USER]]
connect to new database (currently "jseymour")
[snip]

jseymour=> \l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
bookbiz | jseymour | SQL_ASCII
bookbiz2 | jseymour | SQL_ASCII
jseymour | jseymour | SQL_ASCII
mydb | jseymour | SQL_ASCII
[snip]
(12 rows)

jseymour=> \c mydb
You are now connected to database "mydb".
mydb=>

HTH,
Jim

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Andrew Biagioni
2004-06-07 22:28:39 UTC
Permalink
Jeff,

you need to look under "\?" (psql commands), not "\h" (SQL commands).

Anyway, what you need is:

\c[onnect] [DBNAME|- [USER]]
connect to new database (currently "[...]")
Post by Jeff Stout
I am fairly new to postgres, I need to know how to switch
databases once I'm in a psql session. I can't seem to find the
command for \h , maybe I just blind |-;
Thank you in advance
Jeff Stout
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
Jeff Stout
2004-06-28 21:10:12 UTC
Permalink
I am using the /contrib/start-scripts/linux file to set
up postgres to automatically restart upon reboot.

I set it up /etc/init.d/postgres which calls pg_ctl

pg_ctl invokes postmaster

where do I set the -i option to allow tcp connection?

I am able to set the database to start upon boot, but
can not get pgAdmin to connect.

Thank you in advance for you help.

Jeff
CCT


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
Peter Eisentraut
2004-06-28 21:32:42 UTC
Permalink
Post by Jeff Stout
I am using the /contrib/start-scripts/linux file to set
up postgres to automatically restart upon reboot.
I set it up /etc/init.d/postgres which calls pg_ctl
pg_ctl invokes postmaster
where do I set the -i option to allow tcp connection?
In /usr/local/pgsql/data/postgresql.conf (or your local equivalent
database directory), set

tcpip_socket = true

and do pg_ctl reload


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Jim Seymour
2004-06-28 21:57:28 UTC
Permalink
Post by Jeff Stout
I am using the /contrib/start-scripts/linux file to set
up postgres to automatically restart upon reboot.
I set it up /etc/init.d/postgres which calls pg_ctl
pg_ctl invokes postmaster
where do I set the -i option to allow tcp connection?
[snip]

Set "tcpip_socket = true" in $PGDATA/postgresql.conf and restart.

And you'll want to set up host entries in $PGDATA/pg_hba.conf, as
well.

Jim

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly

Bender, Cheryl
2004-06-28 21:41:46 UTC
Permalink
<<I am able to set the database to start upon boot, but
can not get pgAdmin to connect. >>

The easiest way is to set it in postgresql.conf, which is put in your
data folder when you run initdb.

Near the beginning of the file you should see something like
tcpip_socket=true
port=5432

Except that these lines are commented out by default. Uncomment them
and restart pgsql after saving this file.

I almost forgot--If you haven't already done this, in order to connect
from pgadmin you will also need to change your pg_hba.conf file as well
to tell it what host(s) to allow.

Here is a simple entry to allow all hosts on a subnet to connect to all
databases

#TYPE DATABASE USER IP-ADDRESS IP-MASK
METHOD
host all all 192.168.0.0
255.255.255.0 trust



Cheryl Bender


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly
Jason Jahn
2004-06-28 21:28:39 UTC
Permalink
I personally use the postgresql.conf file to specify the options for the
server.

tcpip_socket = true
in that file should do the trick.

That file is located in /var/lib/pgsql/data for me (Fedora core 2), but it
may be located elsewhere on your system.

Jason

-----Original Message-----
From: Jeff Stout [mailto:***@cctus.com]
Sent: Monday, June 28, 2004 4:10 PM
Cc: pgsql-***@postgresql.org
Subject: [ADMIN] pg_ctl question


I am using the /contrib/start-scripts/linux file to set
up postgres to automatically restart upon reboot.

I set it up /etc/init.d/postgres which calls pg_ctl

pg_ctl invokes postmaster

where do I set the -i option to allow tcp connection?

I am able to set the database to start upon boot, but
can not get pgAdmin to connect.

Thank you in advance for you help.

Jeff
CCT


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ***@postgresql.org
Loading...