Thread: using psql after you change the default port

using psql after you change the default port

From
David Kerr
Date:
Howdy all

I changed the default port for Postgresql.

Now, when I want to access postgresql via psql (on the db server),
is there a way to make it default to the new port without using -p
or a .psqlrc file?

I sort of assumed that psql connected via a local pipe and not a port.

Thanks

Dave

Re: using psql after you change the default port

From
Scott Marlowe
Date:
On Tue, Dec 22, 2009 at 4:57 PM, David Kerr <dmk@mr-paradox.net> wrote:
> Howdy all
>
> I changed the default port for Postgresql.
>
> Now, when I want to access postgresql via psql (on the db server),
> is there a way to make it default to the new port without using -p
> or a .psqlrc file?

You can set an envvar:

export PGPORT=5433

etc...

Re: using psql after you change the default port

From
"Joshua D. Drake"
Date:
On Tue, 2009-12-22 at 15:57 -0800, David Kerr wrote:
> Howdy all
>
> I changed the default port for Postgresql.
>
> Now, when I want to access postgresql via psql (on the db server),
> is there a way to make it default to the new port without using -p
> or a .psqlrc file?
>

Not that I know of.

> I sort of assumed that psql connected via a local pipe and not a port.

The socket is named... .s.PGSQL.<port>, thus it still needs to know.

Joshua D. Drake




--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
Respect is earned, not gained through arbitrary and repetitive use or Mr. or Sir.

Re: using psql after you change the default port

From
David Kerr
Date:
On Tue, Dec 22, 2009 at 05:01:45PM -0700, Scott Marlowe wrote:
- On Tue, Dec 22, 2009 at 4:57 PM, David Kerr <dmk@mr-paradox.net> wrote:
- > Howdy all
- >
- > I changed the default port for Postgresql.
- >
- > Now, when I want to access postgresql via psql (on the db server),
- > is there a way to make it default to the new port without using -p
- > or a .psqlrc file?
-
- You can set an envvar:
-
- export PGPORT=5433
-
- etc...

ok thanks, that might be an easier way to handle my scripts.

can you export PGHOST as well?

Dave

Re: using psql after you change the default port

From
"Joshua D. Drake"
Date:
On Tue, 2009-12-22 at 16:08 -0800, David Kerr wrote:

> - export PGPORT=5433
> -
> - etc...
>
> ok thanks, that might be an easier way to handle my scripts.
>
> can you export PGHOST as well?

The manual provides a list:

http://www.postgresql.org/docs/8.3/static/libpq-envars.html

Joshua D. Drake


>
> Dave
>


--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
Respect is earned, not gained through arbitrary and repetitive use or Mr. or Sir.

Re: using psql after you change the default port

From
David Kerr
Date:
On Tue, Dec 22, 2009 at 04:17:05PM -0800, Joshua D. Drake wrote:
- On Tue, 2009-12-22 at 16:08 -0800, David Kerr wrote:
-
- > - export PGPORT=5433
- > -
- > - etc...
- >
- > ok thanks, that might be an easier way to handle my scripts.
- >
- > can you export PGHOST as well?
-
- The manual provides a list:
-
- http://www.postgresql.org/docs/8.3/static/libpq-envars.html
-
- Joshua D. Drake
-

cool thanks

Dave

Re: using psql after you change the default port

From
"Joshua D. Drake"
Date:
On Tue, 2009-12-22 at 15:57 -0800, David Kerr wrote:
> Howdy all
>
> I changed the default port for Postgresql.
>
> Now, when I want to access postgresql via psql (on the db server),
> is there a way to make it default to the new port without using -p
> or a .psqlrc file?
>

Not that I know of.

> I sort of assumed that psql connected via a local pipe and not a port.

The socket is named... .s.PGSQL.<port>, thus it still needs to know.

Joshua D. Drake




--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
Respect is earned, not gained through arbitrary and repetitive use or Mr. or Sir.


Re: using psql after you change the default port

From
"Joshua D. Drake"
Date:
On Tue, 2009-12-22 at 16:08 -0800, David Kerr wrote:

> - export PGPORT=5433
> -
> - etc...
>
> ok thanks, that might be an easier way to handle my scripts.
>
> can you export PGHOST as well?

The manual provides a list:

http://www.postgresql.org/docs/8.3/static/libpq-envars.html

Joshua D. Drake


>
> Dave
>


--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
Respect is earned, not gained through arbitrary and repetitive use or Mr. or Sir.