Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fRGoN-0004Ma-Ek for pgsql-general@arkaria.postgresql.org; Fri, 08 Jun 2018 12:48:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fRGoM-0000D1-9T for pgsql-general@arkaria.postgresql.org; Fri, 08 Jun 2018 12:48:10 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fRGoL-0000Cs-Ul for pgsql-general@lists.postgresql.org; Fri, 08 Jun 2018 12:48:10 +0000 Received: from mail-wm0-f41.google.com ([74.125.82.41]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fRGoE-00027v-7g for pgsql-general@lists.postgresql.org; Fri, 08 Jun 2018 12:48:08 +0000 Received: by mail-wm0-f41.google.com with SMTP id p126-v6so3158736wmb.2 for ; Fri, 08 Jun 2018 05:48:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=BGQLTnc0xBr3Rqf4aFvFh+FQmFVHPAgWuOD3JP/wwxE=; b=V8RFVQEgZzF8LiR1qRVIH+5mbK9NdpKv3fUkpFwAU6FT7YT4SSA/J2JXr4lSiOGzaC sI2s6p2yYd4udi6W1+ToPJYPiYbboEybDOBN6x97UXjmnBakZXy3EGJDQviHdML1Fjuj gqEEiNshUcDRQO46B5embW/awJL7iE9uQ2ppiJjh5NB/ssE3yfY4mtLwSn/imOQam9Yg M0lgc3sCdT2KXFXTw5C2YjrOpCPBIkhQm1+SdTJNL0fLdMHMIb5wDpoxBny+yxFEtkji qxlD/dbqMYyt8EHrv7Q7lXtiXVjaa1BCqlpxkLev4FvqeCZtw37n1mtoJK7GhdrQnFBB 1otQ== X-Gm-Message-State: APt69E0EMKDfgOsvo6nAKumkg3v5g+XUzXPjoulwK65nw63jSDO8Hgpk vzbOI/Yq/BnVhEa8qcHQz4tPpZNBIBHhsdCY4F+X X-Google-Smtp-Source: ADUXVKKkM0+yOrlytnOFp8wJEJ9Syo3+HdF7i456nK+VDFFLvCkV7rWaUxyw+4KQj2G5U5X1Miv7+Xc4EL6GuzhVhao= X-Received: by 2002:a1c:8410:: with SMTP id g16-v6mr1506970wmd.26.1528462080860; Fri, 08 Jun 2018 05:48:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Geoff Winkless Date: Fri, 8 Jun 2018 13:47:49 +0100 Message-ID: Subject: Re: manipulating NUMERIC values in C extension To: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 8 Jun 2018 at 13:27, Geoff Winkless 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