| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Jonah Shafran <jonahshafran(at)gmail(dot)com> |
| Cc: | Daniel Gustafsson <daniel(at)yesql(dot)se>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: ISBN range table |
| Date: | 2026-11-17 08:09:19 |
| Message-ID: | 8769562b-9ef6-4116-968c-c6099a98f0c0@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 17/11/2026 02:39, Jonah Shafran wrote:
> I agree with your assessment that this is unrelated to the patch- I was
> able to reproduce this back to Postgres 17 (the oldest version I had
> running on hand).
I guess it's been like this forever -- I could reproduce it in PG11:
psql (11.22 (Debian 11.22-1.pgdg110+1))
Geben Sie »help« für Hilfe ein.
postgres=# create extension isn;
CREATE EXTENSION
postgres=# with j (v1,v2) as (
values ('12345679'::issn, '9771234567898'::issn)
)
select v1,v2,v1=v2,v1::text=v2::text from j;
v1 | v2 | ?column? | ?column?
-----------+-----------+----------+----------
1234-5679 | 1234-5679 | f | t
(1 Zeile)
> As far as what is going on, it looks like ISSNs are
> specified to use the short output format (isn_out, see isn--1.1.sql line
> 154), however, ISSNs don't seem to get normalized to one canonical form
> when being read in by issn_in. I wasn't able to determine how ISBNs are
> being handled differently with the time I had today, but it looks like
> something in string2ean must be processing the ISBN and ISSN strings
> differently.
What about making ean2ISSN return early when the issue pub code is not
00? e.g.
diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c
index a1d2f26158a..141d05d910e 100644
--- a/contrib/isn/isn.c
+++ b/contrib/isn/isn.c
@@ -472,6 +472,11 @@ static inline void
ean2ISSN(char *isn)
{
unsigned check;
+ char digits[MAXEAN13LEN + 1];
+
+ dehyphenate(digits, isn);
+ if (strncmp(digits + 10, "00", 2) != 0)
+ return;
/* the number should come in this format: 977-0000-000-00-0 */
/* Strip the first part, crop, and calculate the new check digit */
psql (20devel)
Type "help" for help.
postgres=# with j (v1,v2) as (
values ('12345679'::issn, '9771234567898'::issn)
)
select v1,v2,v1=v2,v1::text=v2::text from j;
v1 | v2 | ?column? | ?column?
-----------+-------------------+----------+----------
1234-5679 | 977-1234-567-89-8 | f | f
(1 row)
Best, Jim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-11-17 08:14:30 | Re: Add a hook for handling logical decoding messages on subscribers. |
| Previous Message | Jakub Wartak | 2026-11-17 07:49:17 | Re: [PATCH] basebackup: use sequential access advice for full-file reads |