pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Demitri Muna <postgresql@demitri.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Getting a primitive numeric value from "DatumGetNumeric"?
Date: Thu, 22 Feb 2018 20:00:45 -0500
Message-ID: <19E43B98-06A3-4D78-9F86-B69D12D4BAFD@demitri.com> (raw)
In-Reply-To: <21871.1519185281@sss.pgh.pa.us>
References: <A3E2B8BE-7EE5-4555-90D8-09C832F7B558@demitri.com>
	<21871.1519185281@sss.pgh.pa.us>

Hi Tom,

On Feb 20, 2018, at 10:54 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Well, the implicit coercions work in your favor in this particular case.

Ah, I wasn’t aware of implicit coercion. Yes, that solves the problem perfectly, thanks.

Out of curiosity, how does one read a numeric type from within a C extension (i.e. get a number value out of the Datum type)? I ask as I was unable to find an example and there are a few open questions on Stack Overflow (e.g. https://stackoverflow.com/questions/12588554/postgres-c-function-passing-returning-numerics).

Thanks,
Demitri





view thread (6+ messages)  latest in thread

Message-ID: <19E43B98-06A3-4D78-9F86-B69D12D4BAFD@demitri.com>
Permalink:  ../19E43B98-06A3-4D78-9F86-B69D12D4BAFD@demitri.com/
Also on:    postgresql.org/message-id/19E43B98-06A3-4D78-9F86-B69D12D4BAFD@demitri.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: postgresql@demitri.com
  Subject: Re: Getting a primitive numeric value from "DatumGetNumeric"?
  In-Reply-To: <19E43B98-06A3-4D78-9F86-B69D12D4BAFD@demitri.com>
  References: <A3E2B8BE-7EE5-4555-90D8-09C832F7B558@demitri.com> <21871.1519185281@sss.pgh.pa.us> <19E43B98-06A3-4D78-9F86-B69D12D4BAFD@demitri.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