| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> | 
|---|---|
| To: | Ben Kim <bkim(at)tamu(dot)edu> | 
| Cc: | "Sofer, Yuval" <Yuval_Sofer(at)bmc(dot)com>, pgsql-admin(at)postgresql(dot)org, "Abraham, Danny" <danny_abraham(at)bmc(dot)com> | 
| Subject: | Re: problem with pg_stat_activity view | 
| Date: | 2008-09-08 13:44:39 | 
| Message-ID: | 20080908134439.GB4411@alvh.no-ip.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-admin | 
>> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2008-09-08 14:14:47 | Re: problem with pg_stat_activity view | 
| Previous Message | Ben Kim | 2008-09-08 13:37:35 | Re: problem with pg_stat_activity view |