pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem with pg_stat_activity view
6+ messages / 4 participants
[nested] [flat]
* problem with pg_stat_activity view
@ 2008-09-08 11:28 Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-09-08 13:27 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
0 siblings, 1 reply; 6+ messages in thread
From: Sofer, Yuval @ 2008-09-08 11:28 UTC (permalink / raw)
To: pgsql-admin; +Cc: Abraham, Danny <danny_abraham@bmc.com>
Hello,
postgres version: 8.2.0.4
platform windows: server 2008
I check connections using:
SELECT pg_stat_get_backend_idset()
Now, I take the output and try to get the ip addresses using
select pg_stat_get_backend_client_addr(<integer>);
but for a local connection (simple login using psql), I get the next
error:
ERROR: invalid input syntax for type inet:
"fe80::104d:416e:a8dc:c02e%12"
SQL state: 22P02
The same error occurs for simple "select * pg_stat_activity" (of course,
as it is based on the former function)
I noticed that for netstat -r -n, I got the next line (among the
others):
12 266 fe80::104d:416e:a8dc:c02e/128
May the last 8 was removed and therefore the ip became illegal ?
Need your help
Thanks,
Yuval Sofer
BMC Software
CTM&D Business Unit
DBA Team
972-52-4286-282
yuval_sofer@bmc.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with pg_stat_activity view
2008-09-08 11:28 problem with pg_stat_activity view Sofer, Yuval <Yuval_Sofer@bmc.com>
@ 2008-09-08 13:27 ` Ben Kim <bkim@tamu.edu>
2008-09-08 13:37 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
2008-09-08 13:44 ` Re: problem with pg_stat_activity view Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 2 replies; 6+ messages in thread
From: Ben Kim @ 2008-09-08 13:27 UTC (permalink / raw)
To: Sofer, Yuval <Yuval_Sofer@bmc.com>; +Cc: pgsql-admin@postgresql.org, "Abraham, Danny" <danny_abraham@bmc.com>
fe80::104d:416e:a8dc:c02e %12
Since %12 is a "space" character, it seems first thing to do might be an
extra space in your code. Just a quick guess.
Regards,
Ben Kim
On Mon, 8 Sep 2008, Sofer, Yuval wrote:
> Hello,
>
>
>
> postgres version: 8.2.0.4
>
> platform windows: server 2008
>
>
>
> I check connections using:
>
>
>
> SELECT pg_stat_get_backend_idset()
>
>
>
> Now, I take the output and try to get the ip addresses using
>
>
>
> select pg_stat_get_backend_client_addr(<integer>);
>
>
>
> but for a local connection (simple login using psql), I get the next
> error:
>
>
>
> ERROR: invalid input syntax for type inet:
> "fe80::104d:416e:a8dc:c02e%12"
>
> SQL state: 22P02
>
>
>
> The same error occurs for simple "select * pg_stat_activity" (of course,
> as it is based on the former function)
>
>
>
> I noticed that for netstat -r -n, I got the next line (among the
> others):
>
>
>
> 12 266 fe80::104d:416e:a8dc:c02e/128
>
>
>
> May the last 8 was removed and therefore the ip became illegal ?
>
>
>
> Need your help
>
>
>
> Thanks,
>
>
>
> Yuval Sofer
> BMC Software
> CTM&D Business Unit
>
> DBA Team
> 972-52-4286-282
> yuval_sofer@bmc.com
>
>
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with pg_stat_activity view
2008-09-08 11:28 problem with pg_stat_activity view Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-09-08 13:27 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
@ 2008-09-08 13:37 ` Ben Kim <bkim@tamu.edu>
1 sibling, 0 replies; 6+ messages in thread
From: Ben Kim @ 2008-09-08 13:37 UTC (permalink / raw)
To: Sofer, Yuval <Yuval_Sofer@bmc.com>; +Cc: pgsql-admin@postgresql.org, "Abraham, Danny" <danny_abraham@bmc.com>
Sorry, I apologize for the mistake. %20 is the space, and the extra %12
seems to be DC3 (device control 3).
Regards,
Ben Kim
On Mon, 8 Sep 2008, Ben Kim wrote:
>
> fe80::104d:416e:a8dc:c02e %12
>
> Since %12 is a "space" character, it seems first thing to do might be an extra
> space in your code. Just a quick guess.
>
> Regards,
>
> Ben Kim
>
>
> On Mon, 8 Sep 2008, Sofer, Yuval wrote:
>
>> Hello,
>>
>>
>>
>> postgres version: 8.2.0.4
>>
>> platform windows: server 2008
>>
>>
>>
>> I check connections using:
>>
>>
>>
>> SELECT pg_stat_get_backend_idset()
>>
>>
>>
>> Now, I take the output and try to get the ip addresses using
>>
>>
>>
>> select pg_stat_get_backend_client_addr(<integer>);
>>
>>
>>
>> but for a local connection (simple login using psql), I get the next
>> error:
>>
>>
>>
>> ERROR: invalid input syntax for type inet:
>> "fe80::104d:416e:a8dc:c02e%12"
>>
>> SQL state: 22P02
>>
>>
>>
>> The same error occurs for simple "select * pg_stat_activity" (of course,
>> as it is based on the former function)
>>
>>
>>
>> I noticed that for netstat -r -n, I got the next line (among the
>> others):
>>
>>
>>
>> 12 266 fe80::104d:416e:a8dc:c02e/128
>>
>>
>>
>> May the last 8 was removed and therefore the ip became illegal ?
>>
>>
>>
>> Need your help
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Yuval Sofer
>> BMC Software
>> CTM&D Business Unit
>>
>> DBA Team
>> 972-52-4286-282
>> yuval_sofer@bmc.com
>>
>>
>>
>>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with pg_stat_activity view
2008-09-08 11:28 problem with pg_stat_activity view Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-09-08 13:27 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
@ 2008-09-08 13:44 ` Alvaro Herrera <alvherre@commandprompt.com>
2008-09-08 14:14 ` Re: problem with pg_stat_activity view Tom Lane <tgl@sss.pgh.pa.us>
2008-09-08 14:15 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
1 sibling, 2 replies; 6+ messages in thread
From: Alvaro Herrera @ 2008-09-08 13:44 UTC (permalink / raw)
To: Ben Kim <bkim@tamu.edu>; +Cc: Sofer, Yuval <Yuval_Sofer@bmc.com>; pgsql-admin@postgresql.org, "Abraham, Danny" <danny_abraham@bmc.com>
>> ERROR: invalid input syntax for type inet:
>> "fe80::104d:416e:a8dc:c02e%12"
>>
>> SQL state: 22P02
Interesting.
When we HAVE_IPV6, there's code to remove stuff after a % in an address.
My bet is that what you're running was not compiled with HAVE_IPV6 and
so the code is not executed. Obviously this is invoked in
pg_stat_get_backend_client_addr().
/*
* clean_ipv6_addr --- remove any '%zone' part from an IPv6 address string
*
* XXX This should go away someday!
*
* This is a kluge needed because we don't yet support zones in stored inet
* values. Since the result of getnameinfo() might include a zone spec,
* call this to remove it anywhere we want to feed getnameinfo's output to
* network_in. Beats failing entirely.
*
* An alternative approach would be to let network_in ignore %-parts for
* itself, but that would mean we'd silently drop zone specs in user input,
* which seems not such a good idea.
*/
void
clean_ipv6_addr(int addr_family, char *addr)
{
#ifdef HAVE_IPV6
if (addr_family == AF_INET6)
{
char *pct = strchr(addr, '%');
if (pct)
*pct = '\0';
}
#endif
}
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with pg_stat_activity view
2008-09-08 11:28 problem with pg_stat_activity view Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-09-08 13:27 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
2008-09-08 13:44 ` Re: problem with pg_stat_activity view Alvaro Herrera <alvherre@commandprompt.com>
@ 2008-09-08 14:14 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 6+ messages in thread
From: Tom Lane @ 2008-09-08 14:14 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: Ben Kim <bkim@tamu.edu>; Sofer, Yuval <Yuval_Sofer@bmc.com>; pgsql-admin@postgresql.org, "Abraham, Danny" <danny_abraham@bmc.com>
Alvaro Herrera <alvherre@commandprompt.com> writes:
> ERROR: invalid input syntax for type inet:
> "fe80::104d:416e:a8dc:c02e%12"
>
> SQL state: 22P02
> Interesting.
> When we HAVE_IPV6, there's code to remove stuff after a % in an address.
We do now ... it wasn't there in 8.2.0.
http://archives.postgresql.org/pgsql-committers/2007-05/msg00268.php
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: problem with pg_stat_activity view
2008-09-08 11:28 problem with pg_stat_activity view Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-09-08 13:27 ` Re: problem with pg_stat_activity view Ben Kim <bkim@tamu.edu>
2008-09-08 13:44 ` Re: problem with pg_stat_activity view Alvaro Herrera <alvherre@commandprompt.com>
@ 2008-09-08 14:15 ` Ben Kim <bkim@tamu.edu>
1 sibling, 0 replies; 6+ messages in thread
From: Ben Kim @ 2008-09-08 14:15 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: Sofer, Yuval <Yuval_Sofer@bmc.com>; pgsql-admin@postgresql.org, "Abraham, Danny" <danny_abraham@bmc.com>
That explains it... I thought it was a precent encoding but at the same
time a strange place for a control character.
Regards,
Ben Kim
On Mon, 8 Sep 2008, Alvaro Herrera wrote:
>
>>> ERROR: invalid input syntax for type inet:
>>> "fe80::104d:416e:a8dc:c02e%12"
>>>
>>> SQL state: 22P02
>
> Interesting.
>
> When we HAVE_IPV6, there's code to remove stuff after a % in an address.
> My bet is that what you're running was not compiled with HAVE_IPV6 and
> so the code is not executed. Obviously this is invoked in
> pg_stat_get_backend_client_addr().
>
> /*
> * clean_ipv6_addr --- remove any '%zone' part from an IPv6 address string
> *
> * XXX This should go away someday!
> *
> * This is a kluge needed because we don't yet support zones in stored inet
> * values. Since the result of getnameinfo() might include a zone spec,
> * call this to remove it anywhere we want to feed getnameinfo's output to
> * network_in. Beats failing entirely.
> *
> * An alternative approach would be to let network_in ignore %-parts for
> * itself, but that would mean we'd silently drop zone specs in user input,
> * which seems not such a good idea.
> */
> void
> clean_ipv6_addr(int addr_family, char *addr)
> {
> #ifdef HAVE_IPV6
> if (addr_family == AF_INET6)
> {
> char *pct = strchr(addr, '%');
>
> if (pct)
> *pct = '\0';
> }
> #endif
> }
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2008-09-08 14:15 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-09-08 11:28 problem with pg_stat_activity view Sofer, Yuval <Yuval_Sofer@bmc.com>
2008-09-08 13:27 ` Ben Kim <bkim@tamu.edu>
2008-09-08 13:37 ` Ben Kim <bkim@tamu.edu>
2008-09-08 13:44 ` Alvaro Herrera <alvherre@commandprompt.com>
2008-09-08 14:14 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-09-08 14:15 ` Ben Kim <bkim@tamu.edu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox