Skip site navigation (1) Skip section navigation (2)

Function proposal to find the type of a datum

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: (view raw, whole thread or download thread mbox)
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:

(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

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,


pgsql-hackers by date

Next:From: Tom LaneDate: 2007-02-02 01:03:27
Subject: Re: [HACKERS] Full page writes improvement
Previous:From: Tom LaneDate: 2007-02-02 00:41:39
Subject: Re: writing new regexp functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group