Function proposal to find the type of a datum - Mailing list pgsql-hackers

From Kate F
Subject Function proposal to find the type of a datum
Date
Msg-id 20070202005335.GB31510@cats.meow.at
Whole thread Raw
List 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


pgsql-hackers by date:

Previous
From: Jeremy Drake
Date:
Subject: Re: writing new regexp functions
Next
From: Chander Ganesan
Date:
Subject: Re: About PostgreSQL certification