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 10:27:37 -0400
Message-ID: <24822.1525789657@sss.pgh.pa.us> (raw )
In-Reply-To: <bab83c35-2a25-927b-d28d-f836402c48ba@sigaev.ru >
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 >
Teodor Sigaev <teodor@sigaev.ru> writes:
> Does anybody have an objections to patch?
1) Does this really pass muster from the translatability standpoint?
I doubt it. I'd expect the translation of "cannot cast jsonb string
to int4" to use a translated equivalent of "string", but this code will
not do that. You can't really fix it by gettext'ing the result of
JsonbTypeName, either, because then you're breaking the rule about not
assembling translated strings from components.
2) Our usual convention for type names that are written in error messages
is to use the SQL-standard names, that is "integer" and "double precision"
and so on. For instance, float8in and int4in do not use the internal type
names in their messages:
regression=# select 'bogus'::float8;
ERROR: invalid input syntax for type double precision: "bogus"
LINE 1: select 'bogus'::float8;
^
regression=# select 'bogus'::int4;
ERROR: invalid input syntax for integer: "bogus"
LINE 1: select 'bogus'::int4;
^
So I think you made the wrong choices in jsonb_int4 etc.
regards, tom lane
view thread (31+ messages) latest in thread
Message-ID: <24822.1525789657@sss.pgh.pa.us>
Permalink: ../24822.1525789657@sss.pgh.pa.us/
Also on: postgresql.org/message-id/24822.1525789657@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: <24822.1525789657@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