Обсуждение: Migrating from 8.2 to 9.1 : invalid port number

Поиск
Список
Период
Сортировка

Migrating from 8.2 to 9.1 : invalid port number

От
Alberto Zanon
Дата:
Hi all,

in my production environment I have Postgresql 8.2 + PgPool. The port number I specify in PgPool configuration is not a real portnumber (e.g. 123456). I can define a "dblink" as :

dblink('dbname=XXXX host=/var/run port=123456 user=XXXX password=XXXX'::text, 'select ... '::text) t1( ... );

or start "psql" as:

psql -U XXXX -h /var/run -p 123456 XXXX

without problems. In my development environment I upgraded to 9.1 version and the result is:

invalid port number: "123456"

in both cases. Does Postgresql 9.1 check the "port number" value although I'm connecting through a "Unix domain socket"? Is it a bug or an intended behavior?
I noticed that it accepts values up to 65535.


Thanks in advance

Alberto

Re: Migrating from 8.2 to 9.1 : invalid port number

От
Merlin Moncure
Дата:
On Wed, May 23, 2012 at 7:56 AM, Alberto Zanon
<alberto.zanon@edistar.com> wrote:
> Hi all,
>
> in my production environment I have Postgresql 8.2 + PgPool. The port number
> I specify in PgPool configuration is not a real portnumber (e.g. 123456). I
> can define a "dblink" as :
>
> dblink('dbname=XXXX host=/var/run port=123456 user=XXXX
> password=XXXX'::text, 'select ... '::text) t1( ... );
>
> or start "psql" as:
>
> psql -U XXXX -h /var/run -p 123456 XXXX
>
> without problems. In my development environment I upgraded to 9.1 version
> and the result is:
>
> invalid port number: "123456"
>
> in both cases. Does Postgresql 9.1 check the "port number" value although
> I'm connecting through a "Unix domain socket"? Is it a bug or an intended
> behavior?
> I noticed that it accepts values up to 65535.

65535 is the highest port number so what's happening here is 9.1 is
just doing error checking on the input value which is totally normal
and expected.  why are you supplying a bogus port number?

merlin

Re: Migrating from 8.2 to 9.1 : invalid port number

От
Alberto Zanon
Дата:
Thanks Merlin for the reply,

when you define a "
Unix domain socket" you can use any number because it's just used for the filename, e.g. "/var/run/.s.PGSQL.123456".
It works in PgPool and Postgres 8.2 with no problems.


Alberto


Da: "Merlin Moncure" <mmoncure@gmail.com>
A: "Alberto Zanon" <alberto.zanon@edistar.com>
Cc: pgsql-general@postgresql.org
Inviato: Mercoledì, 23 maggio 2012 15:45:26
Oggetto: Re: [GENERAL] Migrating from 8.2 to 9.1 : invalid port number

On Wed, May 23, 2012 at 7:56 AM, Alberto Zanon
<alberto.zanon@edistar.com> wrote:
> Hi all,
>
> in my production environment I have Postgresql 8.2 + PgPool. The port number
> I specify in PgPool configuration is not a real portnumber (e.g. 123456). I
> can define a "dblink" as :
>
> dblink('dbname=XXXX host=/var/run port=123456 user=XXXX
> password=XXXX'::text, 'select ... '::text) t1( ... );
>
> or start "psql" as:
>
> psql -U XXXX -h /var/run -p 123456 XXXX
>
> without problems. In my development environment I upgraded to 9.1 version
> and the result is:
>
> invalid port number: "123456"
>
> in both cases. Does Postgresql 9.1 check the "port number" value although
> I'm connecting through a "Unix domain socket"? Is it a bug or an intended
> behavior?
> I noticed that it accepts values up to 65535.

65535 is the highest port number so what's happening here is 9.1 is
just doing error checking on the input value which is totally normal
and expected.  why are you supplying a bogus port number?

merlin

Re: Migrating from 8.2 to 9.1 : invalid port number

От
"Welty, Richard"
Дата:

port numbers are restricted to 2 octets (16 bits). they are TCP/IP entities and are restricted in size by the RFCs (internet standards.)

richard

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Alberto Zanon
Sent: Wed 5/23/2012 10:19 AM
To: Merlin Moncure
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Migrating from 8.2 to 9.1 : invalid port number

Thanks Merlin for the reply,

when you define a " Unix domain socket " you can use any number because it's just used for the filename, e.g. "/var/run/.s.PGSQL.123456".
It works in PgPool and Postgres 8.2 with no problems.


Alberto

----- Messaggio originale -----
Da: "Merlin Moncure" <mmoncure@gmail.com>
A: "Alberto Zanon" <alberto.zanon@edistar.com>
Cc: pgsql-general@postgresql.org
Inviato: Mercoledì, 23 maggio 2012 15:45:26
Oggetto: Re: [GENERAL] Migrating from 8.2 to 9.1 : invalid port number

On Wed, May 23, 2012 at 7:56 AM, Alberto Zanon
<alberto.zanon@edistar.com> wrote:
> Hi all,
>
> in my production environment I have Postgresql 8.2 + PgPool. The port number
> I specify in PgPool configuration is not a real portnumber (e.g. 123456). I
> can define a "dblink" as :
>
> dblink('dbname=XXXX host=/var/run port=123456 user=XXXX
> password=XXXX'::text, 'select ... '::text) t1( ... );
>
> or start "psql" as:
>
> psql -U XXXX -h /var/run -p 123456 XXXX
>
> without problems. In my development environment I upgraded to 9.1 version
> and the result is:
>
> invalid port number: "123456"
>
> in both cases. Does Postgresql 9.1 check the "port number" value although
> I'm connecting through a "Unix domain socket"? Is it a bug or an intended
> behavior?
> I noticed that it accepts values up to 65535.

65535 is the highest port number so what's happening here is 9.1 is
just doing error checking on the input value which is totally normal
and expected. why are you supplying a bogus port number?

merlin

Re: Migrating from 8.2 to 9.1 : invalid port number

От
Alberto Zanon
Дата:
Hi Richard,

I agree with you about the concept of "port number". I only wanted to know if it is a new behavior of Postgresql 9.1.



Alberto


Da: "Richard Welty" <rwelty@ltionline.com>
A: "Alberto Zanon" <alberto.zanon@edistar.com>, "Merlin Moncure" <mmoncure@gmail.com>
Cc: pgsql-general@postgresql.org
Inviato: Mercoledì, 23 maggio 2012 16:50:07
Oggetto: RE: [GENERAL] Migrating from 8.2 to 9.1 : invalid port number

port numbers are restricted to 2 octets (16 bits). they are TCP/IP entities and are restricted in size by the RFCs (internet standards.)

richard

-----Original Message-----
From: pgsql-general-owner@postgresql.org on behalf of Alberto Zanon
Sent: Wed 5/23/2012 10:19 AM
To: Merlin Moncure
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Migrating from 8.2 to 9.1 : invalid port number

Thanks Merlin for the reply,

when you define a " Unix domain socket " you can use any number because it's just used for the filename, e.g. "/var/run/.s.PGSQL.123456".
It works in PgPool and Postgres 8.2 with no problems.


Alberto

----- Messaggio originale -----
Da: "Merlin Moncure" <mmoncure@gmail.com>
A: "Alberto Zanon" <alberto.zanon@edistar.com>
Cc: pgsql-general@postgresql.org
Inviato: Mercoledì, 23 maggio 2012 15:45:26
Oggetto: Re: [GENERAL] Migrating from 8.2 to 9.1 : invalid port number

On Wed, May 23, 2012 at 7:56 AM, Alberto Zanon
<alberto.zanon@edistar.com> wrote:
> Hi all,
>
> in my production environment I have Postgresql 8.2 + PgPool. The port number
> I specify in PgPool configuration is not a real portnumber (e.g. 123456). I
> can define a "dblink" as :
>
> dblink('dbname=XXXX host=/var/run port=123456 user=XXXX
> password=XXXX'::text, 'select ... '::text) t1( ... );
>
> or start "psql" as:
>
> psql -U XXXX -h /var/run -p 123456 XXXX
>
> without problems. In my development environment I upgraded to 9.1 version
> and the result is:
>
> invalid port number: "123456"
>
> in both cases. Does Postgresql 9.1 check the "port number" value although
> I'm connecting through a "Unix domain socket"? Is it a bug or an intended
> behavior?
> I noticed that it accepts values up to 65535.

65535 is the highest port number so what's happening here is 9.1 is
just doing error checking on the input value which is totally normal
and expected. why are you supplying a bogus port number?

merlin

Re: Migrating from 8.2 to 9.1 : invalid port number

От
Tom Lane
Дата:
Alberto Zanon <alberto.zanon@edistar.com> writes:
> I agree with you about the concept of "port number". I only wanted to know if it is a new behavior of Postgresql 9.1.


More like 9.0, according to our commit logs:

Author: Tom Lane <tgl@sss.pgh.pa.us>
Branch: master Release: REL9_0_BR [61be11ff0] 2009-09-27 03:43:10 +0000

    Make libpq reject non-numeric and out-of-range port numbers with a suitable
    error message, rather than blundering on and failing with something opaque.

    Sam Mason

            regards, tom lane