pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Geoff Winkless <pgsqladmin@geoff.dj>
To: pgsql-general@lists.postgresql.org
Subject: Re: manipulating NUMERIC values in C extension
Date: Fri, 8 Jun 2018 13:47:49 +0100
Message-ID: <CAEzk6ffs9DBEbypK53Sg4DMQi6Rr1BFLaLR2ApGoQzodO2NgOA@mail.gmail.com> (raw)
In-Reply-To: <CAEzk6feVfZJVGTdWqsX5WoDGXmZzUKVa9FBrireE9_Cmkz2ifA@mail.gmail.com>
References: <CAEzk6feVfZJVGTdWqsX5WoDGXmZzUKVa9FBrireE9_Cmkz2ifA@mail.gmail.com>

On Fri, 8 Jun 2018 at 13:27, Geoff Winkless <pgsqladmin@geoff.dj> wrote:
> numeric_in looks like it might do what I want but to do that I would
> have to build a FunctionCallInfo struct to do that, and I'm not 100%
> clear how to do that either :(

Answering my own question, looks like

  res = DatumGetNumeric(DirectFunctionCall3(numeric_in,
CStringGetDatum(buf), 0, -1));

should do it, judging from
https://api.pgxn.org/src/orafce/orafce-3.6.1/convert.c

Geoff




view thread (5+ messages)  latest in thread

Message-ID: <CAEzk6ffs9DBEbypK53Sg4DMQi6Rr1BFLaLR2ApGoQzodO2NgOA@mail.gmail.com>
Permalink:  ../CAEzk6ffs9DBEbypK53Sg4DMQi6Rr1BFLaLR2ApGoQzodO2NgOA@mail.gmail.com/
Also on:    postgresql.org/message-id/CAEzk6ffs9DBEbypK53Sg4DMQi6Rr1BFLaLR2ApGoQzodO2NgOA@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: pgsqladmin@geoff.dj
  Subject: Re: manipulating NUMERIC values in C extension
  In-Reply-To: <CAEzk6ffs9DBEbypK53Sg4DMQi6Rr1BFLaLR2ApGoQzodO2NgOA@mail.gmail.com>
  References: <CAEzk6feVfZJVGTdWqsX5WoDGXmZzUKVa9FBrireE9_Cmkz2ifA@mail.gmail.com> <CAEzk6ffs9DBEbypK53Sg4DMQi6Rr1BFLaLR2ApGoQzodO2NgOA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox