pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Teodor Sigaev <teodor@sigaev.ru>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>
Cc: David Steele <david@pgmasters.net>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: Darafei Praliaskouski <me@komzpa.net>
Cc: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Cast jsonb to numeric, int, float, bool
Date: Tue, 08 May 2018 11:17:13 -0400
Message-ID: <2087.1525792633@sss.pgh.pa.us> (raw )
In-Reply-To: <24822.1525789657@sss.pgh.pa.us >
References: <151985418868.6915.17223208131889314092.pgcf@coridan.postgresql.org >
<76b000ae-94d1-cd8f-a2e0-e536096469b0@postgrespro.ru >
<d75ed4fe-574b-41c7-080f-ed662fa5d9ba@pgmasters.net >
<20180327145337.GA20311@e733.localdomain >
<ca0bdf99-98a5-3a44-3f49-13941e0634ca@sigaev.ru >
<912e1a07-90a9-ad97-bc70-d71ec0f6f073@sigaev.ru >
<be43822f-7fd2-c5c2-8435-6a896d1ed46c@sigaev.ru >
<CA+Tgmob08StTV9yu04D0idRFNMh+UoyKax5Otvrix7rEZC8rMw@mail.gmail.com >
<0250b45d-4a38-5453-cb5a-8fa9883da36b@sigaev.ru >
<20180330142119.GA1411@e733.localdomain >
<20180330142423.GB1411@e733.localdomain >
<d8j1sg1mvwp.fsf@dalvik.ping.uio.no >
<CA+TgmoaYgUkbrpzYgBPhH31+9BioCRs3RF2Bcz8E-+zttcCB4A@mail.gmail.com >
<bab83c35-2a25-927b-d28d-f836402c48ba@sigaev.ru >
<24822.1525789657@sss.pgh.pa.us >
I wrote:
> 1) Does this really pass muster from the translatability standpoint?
> I doubt it.
After further thought about that, it seems that what we typically don't
try to translate is SQL-standard type names, that is, error messages
along the line of "blah blah blah type %s" are considered fine. So
the problem here is that you factorized the error reporting poorly.
I think you want the callers to look like
if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric)
cannotCastJsonbValue(v.type, "double precision");
where the subroutine contains the whole ereport() call, and its lookup
table entries are e.g.
gettext_noop("cannot cast jsonb string to type %s")
regards, tom lane
view thread (31+ messages) latest in thread
Message-ID: <2087.1525792633@sss.pgh.pa.us>
Permalink: ../2087.1525792633@sss.pgh.pa.us/
Also on: postgresql.org/message-id/2087.1525792633@sss.pgh.pa.us
copy link · copy postgr.es
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, teodor@sigaev.ru, robertmhaas@gmail.com, ilmari@ilmari.org, a.alekseev@postgrespro.ru, david@pgmasters.net, n.gluhov@postgrespro.ru, me@komzpa.net, a.lubennikova@postgrespro.ru, pgsql-hackers@lists.postgresql.org
Subject: Re: Cast jsonb to numeric, int, float, bool
In-Reply-To: <2087.1525792633@sss.pgh.pa.us>
* 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