Re: CStringGetTextDatum and other conversions in server-side code

From: <david(at)andl(dot)org>
To: <pgsql-general-owner+M220387=david=andl(dot)org(at)postgresql(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: CStringGetTextDatum and other conversions in server-side code
Date: 2016-03-03 00:20:27
Message-ID: 002701d174e2$7f4a4620$7dded260$@andl.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 specifically src/pl/* should have even more relevant examples. Remember, grep is your friend -- get a copy of the source tree and 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 deal of inconsistency, and much of the code looks like "Summer of Code", or has been written a number of years ago or talks about issues I know have been resolved, or says it's just 'legacy support'. The upshot is: I haven't yet been able to figure 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 other than 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2016-03-03 00:53:30 Re: CStringGetTextDatum and other conversions in server-side code
Previous Message cchee-ob 2016-03-02 23:54:03 BDR concern/issue