From: | Kate F <kate(at)cats(dot)meow(dot)at> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Function proposal to find the type of a datum |
Date: | 2007-02-02 00:53:35 |
Message-ID: | 20070202005335.GB31510@cats.meow.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
I found the need to determine the type of a datum at runtime. David
Fetter and Elein have already written about this:
http://www.varlena.com/varlena/GeneralBits/117.php
(My scenario is similar to the article there; I was writing a
procedure which unit-tests other procedures. It needs to know the
type of arguments passed so that when constructing queries, it may
avoid quoting (for example) integers, so that the appropiate function
is selected for those which are overloaded. As I did not want to
assume that a user has permission to create PL functions in C, I
ended up casting to an integer and catching exceptions to determine
failure!)
I think this would be a useful function to expose by default. David
suggested pg_catalog.pg_type_of(ANYELEMENT).
If this is viewed as a good idea, I'd like to try to implement this.
Suggestions welcome,
--
Kate
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-02-02 01:03:27 | Re: [HACKERS] Full page writes improvement |
Previous Message | Tom Lane | 2007-02-02 00:41:39 | Re: writing new regexp functions |