pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Donald Fraser <demolish@cwgsy.net>
To: [pgADMIN] <pgadmin-support@postgresql.org>
Subject: Re: [ADMIN] Overloading functions that are used by operators.
Date: Thu, 10 Jul 2003 18:10:52 +0100
Message-ID: <00b601c34706$3b7ba280$1664a8c0@DEMOLITION> (raw)
References: <03AF4E498C591348A42FC93DEA9661B83AF171@mail.vale-housing.co.uk>
	<7189.1057853195@sss.pgh.pa.us>


----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Dave Page" <dpage@vale-housing.co.uk>
Cc: "Donald Fraser" <demolish@cwgsy.net>; "[ADMIN]"
<pgsql-admin@postgresql.org>; "[pgADMIN]" <pgadmin-support@postgresql.org>
Sent: Thursday, July 10, 2003 5:06 PM
Subject: Re: [ADMIN] [pgadmin-support] Overloading functions that are used by
operators.


> "Dave Page" <dpage@vale-housing.co.uk> writes:
> >> I see no such error here ...
> >>
> >> regression=# create function pg_catalog.textcat(varchar,text)
> >> regression-# returns text as 'textcat' language 'internal';
> >> CREATE FUNCTION
>
> > Andreas (Pflug) reckons it's gone in 7.4, but in 7.3.2 I see:
> > [ complicated query ]
>
> Oh.  I'll bet you're running into the regproc-reverse-conversion
> problem.  'textcat' is one of the histogram values appearing in pg_stats
> for pg_operator.oprcode, right?  The error comes when the planner tries
> to convert that string back to OID form.  We fixed this in 7.4 by
> modifying the way that pg_statistic stores data values, so that no
> conversion needs to occur.
>
> regards, tom lane

Well there you go then... trust me to run into some obscure bug!

I kept asking how it was possible to get the function oid via just the function
name, and nobody pointed out what the undelying data type of
pg_operator.oprcode is.

In that case you can use the subselect approach that I originally suggested and
you will find that it actually works.
That is replace column 'po.proname as operproc,' with '(SELECT po.proname FROM
pg_proc po WHERE po.oid=op.oprcode) as operproc,' and obviously remove the
associated join statment and repeat this for the other two columns: pj.proname
as joinproc and pr.proname as restrproc.

Regards
Donald Fraser.




view thread (11+ messages)

Message-ID: <00b601c34706$3b7ba280$1664a8c0@DEMOLITION>
Permalink:  ../00b601c34706$3b7ba280$1664a8c0@DEMOLITION/
Also on:    postgresql.org/message-id/00b601c34706$3b7ba280$1664a8c0@DEMOLITION

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: demolish@cwgsy.net, pgadmin-support@postgresql.org
  Subject: Re: [ADMIN] Overloading functions that are used by operators.
  In-Reply-To: <00b601c34706$3b7ba280$1664a8c0@DEMOLITION>
  References: <03AF4E498C591348A42FC93DEA9661B83AF171@mail.vale-housing.co.uk> <7189.1057853195@sss.pgh.pa.us> <00b601c34706$3b7ba280$1664a8c0@DEMOLITION>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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