Re: CStringGetTextDatum and other conversions in server-side code - Mailing list pgsql-general

From
Subject Re: CStringGetTextDatum and other conversions in server-side code
Date
Msg-id 002701d174e2$7f4a4620$7dded260$@andl.org
Whole thread Raw
In response to Re: CStringGetTextDatum and other conversions in server-side code  (Joe Conway <mail@joeconway.com>)
Responses Re: CStringGetTextDatum and other conversions in server-side code  (John R Pierce <pierce@hogranch.com>)
Re: CStringGetTextDatum and other conversions in server-side code  (Joe Conway <mail@joeconway.com>)
List pgsql-general
(please do not post HTML to these lists; see:
https://wiki.postgresql.org/wiki/Mailing_Lists)
[dmb>] I checked the list first: it looks like about 25-50% HTML. Happy to oblige, but I think you've got your work cut
out.

> and looks like it might work. Questions:
>
> 1.       Is this the right function?
> 2.       Is it OK to use, or are there restrictions?
> 3.       Does it have friends: are there other conversion functions like
> this for other data types (decimal, time in particular)?
> 4.       Is there any particular documentation I can read?

Your best bet is to look at examples. The code in the source tree under contrib has many examples, and more
specificallysrc/pl/* should have even more relevant examples. Remember, grep is your friend -- get a copy of the source
treeand try: 
[dmb>]
[dmb>] I have the source tree, I use grep and other tools, and I've read thousands of lines of code. There is a great
dealof inconsistency, and much of the code looks like "Summer of Code", or has been written a number of years ago or
talksabout issues I know have been resolved, or says it's just 'legacy support'. The upshot is: I haven't yet been able
tofigure out the 'right' way to do things, or what might go wrong if I choose the 'wrong' way.  

Basically any symbol exported from the postgres backend can be used by your PL. There is not a lot of documentation
otherthan in the source code itself. Look at  
examples, see what they do, emulate it.
[dmb>] That was my plan. But I do prefer to emulate code that is 'right'.

[dmb>] So how would I go about finding a set of useful conversion functions for basic types (real, decimal, time, etc)?

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org







pgsql-general by date:

Previous
From: cchee-ob
Date:
Subject: BDR concern/issue
Next
From: John R Pierce
Date:
Subject: Re: CStringGetTextDatum and other conversions in server-side code