Re: [HACKERS] snprintf()

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 11:20:07PM -0500, Tom Lane wrote: > Kate F <[EMAIL PROTECTED]> writes: > > On Fri, Feb/ 2/07 10:52:28PM -0500, Tom Lane wrote: > >> I wouldn't really have expected that to happen on any *BSD, but you > >> could look into the generated Makef

Re: [HACKERS] snprintf()

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 10:52:28PM -0500, Tom Lane wrote: > Kate F <[EMAIL PROTECTED]> writes: > > ... does PostgreSQL replace my system's snprintf() prototype with > > its own implementation's? > > We do on some platforms where configure decides the system version

[HACKERS] snprintf()

2007-02-02 Thread Kate F
Hello, I've been implementing a type I needed, and happened to be using snprintf(), since I have C99 available. ereport(NOTICE, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("%d", snprintf(NULL, 0, "abc"; For me, this reports "0". I beieve it sh

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 11:37:13AM -0500, Tom Lane wrote: > Kate F <[EMAIL PROTECTED]> writes: > > So, to conclude, we still have a valid use-case (which you explained a > > little more explicitly than I did). Shall I attempt to implement it? > > (that is, type_name_of() which

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 11:17:46AM -0500, Tom Lane wrote: > Kate F <[EMAIL PROTECTED]> writes: > > (And whatever the decision regarding ANYELEMENT of, I believe this > > should behave the same as IS OF) > > In the light of morning I think it may be a non-problem. The way tha

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 09:52:08AM -0500, Tom Lane wrote: > Kate F <[EMAIL PROTECTED]> writes: > > In my case, I am constructing a query (to be exexecuted dynamically) > > wherein I pass along some of the arguments I am given. This query calls > > a function specified by a

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 10:09:24AM +, Richard Huxton wrote: > Kate F wrote: > >I see my misunderstanding: '2' IS OF (INTEGER) yields false: fine. > >However I was expecting that pg_type_of('2') would return 'INTEGER': it > >wouldn't,

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-02 Thread Kate F
On Fri, Feb/ 2/07 03:06:19AM -0500, Tom Lane wrote: > Kate F <[EMAIL PROTECTED]> writes: > > The difference between OF and this function is that this function is > > pulling the type from the datum, rather than explicitly testing it > > against types the user suggests. I

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-01 Thread Kate F
On Fri, Feb/ 2/07 02:41:15AM -0500, Tom Lane wrote: > > > Meanwhile, I still think the function David proposed is a worthy > > addition (and I still have a user-case for it!), as using just the OF > > operator for something similar, one would have to explictly test > > against every type required.

Re: [HACKERS] Function proposal to find the type of a datum

2007-02-01 Thread Kate F
On Fri, Feb/ 2/07 02:17:51AM -0500, Tom Lane wrote: > "Pavel Stehule" <[EMAIL PROTECTED]> writes: > > you can identify type via operator OF. > > > IF a IS OF INTEGER THEN > > RAISE NOTICE 'Parametr a is numeric'; > > Yeah, that is the SQL-standard syntax, but I think our implementation > do

[HACKERS] Function proposal to find the type of a datum

2007-02-01 Thread Kate F
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 k