patch for contrib/isn

Started by Jan Ottoover 15 years ago7 messages
#1Jan Otto
asche@me.com
1 attachment(s)

hi all,

currently i am working on a big project for a german bookseller and
publisher. one of the requirements was correct hyphenation of ISBN-13
for about 14.400.000 books in postgresql database. so added support
for hyphenating isbn with the new 979-prefix and additionally added all
missing ranges since year 2006 for isbn with 978-prefix.

patch against HEAD is attached and validated against a lot of previously
wrong and correct hyphenated isbn.

regards, jan

Attachments:

contrib_isn-1.patchapplication/octet-stream; name=contrib_isn-1.patchDownload
Index: contrib/isn/ISBN.h
===================================================================
RCS file: /Users/asche/Projects/Repositories/postgresql/pgsql/contrib/isn/ISBN.h,v
retrieving revision 1.2
diff -c -c -r1.2 ISBN.h
*** contrib/isn/ISBN.h	4 Oct 2006 00:29:45 -0000	1.2
--- contrib/isn/ISBN.h	4 Aug 2010 17:06:42 -0000
***************
*** 28,45 ****
   *
   */
  
  /* where the digit set begins, and how many of them are in the table */
  const unsigned ISBN_index[10][2] = {
  	{0, 6},
  	{6, 6},
  	{12, 8},
! 	{20, 10},
! 	{30, 6},
! 	{36, 12},
! 	{48, 0},
! 	{48, 5},
! 	{53, 59},
! 	{112, 573},
  };
  
  const char *ISBN_range[][2] = {
--- 28,50 ----
   *
   */
  
+ /*
+  * For ISBN with prefix 978
+  * Range Table as of 2010-Jul-29
+  */
+  
  /* where the digit set begins, and how many of them are in the table */
  const unsigned ISBN_index[10][2] = {
  	{0, 6},
  	{6, 6},
  	{12, 8},
! 	{20, 14},
! 	{34, 6},
! 	{40, 19},
! 	{59, 68},
! 	{127, 5},
! 	{132, 60},
! 	{192, 718},
  };
  
  const char *ISBN_range[][2] = {
***************
*** 72,78 ****
  	{"3-7000", "3-8499"},
  	{"3-85000", "3-89999"},
  	{"3-900000", "3-949999"},
! 	{"3-9500000", "3-9999999"},
  	{"4-00", "4-19"},
  	{"4-200", "4-699"},
  	{"4-7000", "4-8499"},
--- 77,87 ----
  	{"3-7000", "3-8499"},
  	{"3-85000", "3-89999"},
  	{"3-900000", "3-949999"},
! 	{"3-9500000", "3-9539999"},
! 	{"3-95400", "3-96999"},
! 	{"3-9700000", "3-9899999"},
! 	{"3-99000", "3-99499"},
! 	{"3-99500", "3-99999"},
  	{"4-00", "4-19"},
  	{"4-200", "4-699"},
  	{"4-7000", "4-8499"},
***************
*** 80,96 ****
  	{"4-900000", "4-949999"},
  	{"4-9500000", "4-9999999"},
  	{"5-00", "5-19"},
! 	{"5-200", "5-699"},
  	{"5-7000", "5-8499"},
  	{"5-85000", "5-89999"},
  	{"5-900000", "5-909999"},
  	{"5-91000", "5-91999"},
  	{"5-9200", "5-9299"},
  	{"5-93000", "5-94999"},
! 	{"5-9500", "5-9799"},
  	{"5-98000", "5-98999"},
  	{"5-9900000", "5-9909999"},
  	{"5-9910", "5-9999"},
  	{"7-00", "7-09"},
  	{"7-100", "7-499"},
  	{"7-5000", "7-7999"},
--- 89,180 ----
  	{"4-900000", "4-949999"},
  	{"4-9500000", "4-9999999"},
  	{"5-00", "5-19"},
! 	{"5-200", "5-420"},
! 	{"5-4210", "5-4299"},
! 	{"5-430", "5-430"},
! 	{"5-4310", "5-4399"},
! 	{"5-440", "5-440"},
! 	{"5-4410", "5-4499"},
! 	{"5-450", "5-699"},
  	{"5-7000", "5-8499"},
  	{"5-85000", "5-89999"},
  	{"5-900000", "5-909999"},
  	{"5-91000", "5-91999"},
  	{"5-9200", "5-9299"},
  	{"5-93000", "5-94999"},
! 	{"5-9500000", "5-9500999"},
! 	{"5-9501", "5-9799"},
  	{"5-98000", "5-98999"},
  	{"5-9900000", "5-9909999"},
  	{"5-9910", "5-9999"},
+ 	{"600-00", "600-09"},
+ 	{"600-100", "600-499"},
+ 	{"600-5000", "600-8999"},
+ 	{"600-90000", "600-99999"},
+ 	{"601-00", "601-19"},
+ 	{"601-200", "601-699"},
+ 	{"601-7000", "601-7999"},
+ 	{"601-80000", "601-84999"},
+ 	{"601-85", "601-99"},
+ 	{"602-00", "602-19"},
+ 	{"602-200", "602-799"},
+ 	{"602-8000", "602-9499"},
+ 	{"602-95000", "602-99999"},
+ 	{"603-00", "603-04"},
+ 	{"603-05", "603-49"},
+ 	{"603-500", "603-799"},
+ 	{"603-8000", "603-8999"},
+ 	{"603-90000", "603-99999"},
+ 	{"604-0", "604-4"},
+ 	{"604-50", "604-89"},
+ 	{"604-900", "604-979"},
+ 	{"604-9800", "604-9999"},
+ 	{"605-01", "605-09"},
+ 	{"605-100", "605-399"},
+ 	{"605-4000", "605-5999"},
+ 	{"605-60000", "605-89999"},
+ 	{"605-90", "605-99"},
+ 	{"606-0", "606-0"},
+ 	{"606-10", "606-49"},
+ 	{"606-500", "606-799"},
+ 	{"606-8000", "606-9199"},
+ 	{"606-92000", "606-99999"},
+ 	{"607-00", "607-39"},
+ 	{"607-400", "607-749"},
+ 	{"607-7500", "607-9499"},
+ 	{"607-95000", "607-99999"},
+ 	{"608-0", "608-0"},
+ 	{"608-10", "608-19"},
+ 	{"608-200", "608-449"},
+ 	{"608-4500", "608-6499"},
+ 	{"608-65000", "608-69999"},
+ 	{"608-7", "608-9"},
+ 	{"609-00", "609-39"},
+ 	{"609-400", "609-799"},
+ 	{"609-8000", "609-9499"},
+ 	{"609-95000", "609-99999"},
+ 	{"612-00", "612-29"},
+ 	{"612-300", "612-399"},
+ 	{"612-4000", "612-4499"},
+ 	{"612-45000", "612-49999"},
+ 	{"612-50", "612-99"},
+ 	{"613-0", "613-9"},
+ 	{"614-00", "614-39"},
+ 	{"614-400", "614-799"},
+ 	{"614-8000", "614-9499"},
+ 	{"614-95000", "614-99999"},
+ 	{"615-00", "615-09"},
+ 	{"615-100", "615-499"},
+ 	{"615-5000", "615-7999"},
+ 	{"615-80000", "615-89999"},
+ 	{"616-00", "616-19"},
+ 	{"616-200", "616-699"},
+ 	{"616-7000", "616-8999"},
+ 	{"616-90000", "616-99999"},
+ 	{"617-00", "617-49"},
+ 	{"617-500", "617-699"},
+ 	{"617-7000", "617-8999"},
+ 	{"617-90000", "617-99999"},
  	{"7-00", "7-09"},
  	{"7-100", "7-499"},
  	{"7-5000", "7-7999"},
***************
*** 117,123 ****
  	{"83-7000", "83-8499"},
  	{"83-85000", "83-89999"},
  	{"83-900000", "83-999999"},
! 	{"84-00", "84-19"},
  	{"84-200", "84-699"},
  	{"84-7000", "84-8499"},
  	{"84-85000", "84-89999"},
--- 201,208 ----
  	{"83-7000", "83-8499"},
  	{"83-85000", "83-89999"},
  	{"83-900000", "83-999999"},
! 	{"84-00", "84-14"},
! 	{"84-15000", "84-19999"},
  	{"84-200", "84-699"},
  	{"84-7000", "84-8499"},
  	{"84-85000", "84-89999"},
***************
*** 135,142 ****
  	{"85-900000", "85-979999"},
  	{"85-98000", "85-99999"},
  	{"86-00", "86-29"},
! 	{"86-300", "86-699"},
! 	{"86-7000", "86-7999"},
  	{"86-80000", "86-89999"},
  	{"86-900000", "86-999999"},
  	{"87-00", "87-29"},
--- 220,227 ----
  	{"85-900000", "85-979999"},
  	{"85-98000", "85-99999"},
  	{"86-00", "86-29"},
! 	{"86-300", "86-599"},
! 	{"86-6000", "86-7999"},
  	{"86-80000", "86-89999"},
  	{"86-900000", "86-999999"},
  	{"87-00", "87-29"},
***************
*** 161,168 ****
  	{"90-70000", "90-79999"},
  	{"90-800000", "90-849999"},
  	{"90-8500", "90-8999"},
! 	{"90-900000", "90-909999"},
! 	{"90-940000", "90-949999"},
  	{"91-0", "91-1"},
  	{"91-20", "91-49"},
  	{"91-500", "91-649"},
--- 246,255 ----
  	{"90-70000", "90-79999"},
  	{"90-800000", "90-849999"},
  	{"90-8500", "90-8999"},
! 	{"90-90", "90-90"},
! 	{"90-910000", "90-939999"},
! 	{"90-94", "90-94"},
! 	{"90-950000", "90-999999"},
  	{"91-0", "91-1"},
  	{"91-20", "91-49"},
  	{"91-500", "91-649"},
***************
*** 175,180 ****
--- 262,275 ----
  	{"92-9000", "92-9499"},
  	{"92-95000", "92-98999"},
  	{"92-990000", "92-999999"},
+ 	{"93-00", "93-09"},
+ 	{"93-100", "93-499"},
+ 	{"93-5000", "93-7999"},
+ 	{"93-80000", "93-94999"},
+ 	{"93-950000", "93-999999"},
+ 	{"94-000", "94-599"},
+ 	{"94-6000", "94-8999"},
+ 	{"94-90000", "94-99999"},
  	{"950-00", "950-49"},
  	{"950-500", "950-899"},
  	{"950-9000", "950-9899"},
***************
*** 191,212 ****
  	{"952-6600", "952-6699"},
  	{"952-67000", "952-69999"},
  	{"952-7000", "952-7999"},
! 	{"952-89", "952-94"},
  	{"952-9500", "952-9899"},
  	{"952-99000", "952-99999"},
  	{"953-0", "953-0"},
  	{"953-10", "953-14"},
! 	{"953-150", "953-599"},
  	{"953-6000", "953-9499"},
  	{"953-95000", "953-99999"},
! 	{"954-00", "954-29"},
  	{"954-300", "954-799"},
  	{"954-8000", "954-8999"},
  	{"954-90000", "954-92999"},
  	{"954-9300", "954-9999"},
! 	{"955-0", "955-0"},
! 	{"955-1000", "955-1999"},
! 	{"955-20", "955-54"},
  	{"955-550", "955-799"},
  	{"955-8000", "955-9499"},
  	{"955-95000", "955-99999"},
--- 286,309 ----
  	{"952-6600", "952-6699"},
  	{"952-67000", "952-69999"},
  	{"952-7000", "952-7999"},
! 	{"952-80", "952-94"},
  	{"952-9500", "952-9899"},
  	{"952-99000", "952-99999"},
  	{"953-0", "953-0"},
  	{"953-10", "953-14"},
! 	{"953-150", "953-549"},
! 	{"953-55000", "953-59999"},
  	{"953-6000", "953-9499"},
  	{"953-95000", "953-99999"},
! 	{"954-00", "954-28"},
! 	{"954-2900", "954-2999"},
  	{"954-300", "954-799"},
  	{"954-8000", "954-8999"},
  	{"954-90000", "954-92999"},
  	{"954-9300", "954-9999"},
! 	{"955-0000", "955-1999"},
! 	{"955-20", "955-49"},
! 	{"955-50000", "955-54999"},
  	{"955-550", "955-799"},
  	{"955-8000", "955-9499"},
  	{"955-95000", "955-99999"},
***************
*** 223,241 ****
  	{"957-440", "957-819"},
  	{"957-8200", "957-9699"},
  	{"957-97000", "957-99999"},
! 	{"958-00", "958-59"},
  	{"958-600", "958-799"},
  	{"958-8000", "958-9499"},
  	{"958-95000", "958-99999"},
  	{"959-00", "959-19"},
  	{"959-200", "959-699"},
  	{"959-7000", "959-8499"},
  	{"960-00", "960-19"},
  	{"960-200", "960-659"},
  	{"960-6600", "960-6899"},
  	{"960-690", "960-699"},
  	{"960-7000", "960-8499"},
! 	{"960-85000", "960-99999"},
  	{"961-00", "961-19"},
  	{"961-200", "961-599"},
  	{"961-6000", "961-8999"},
--- 320,343 ----
  	{"957-440", "957-819"},
  	{"957-8200", "957-9699"},
  	{"957-97000", "957-99999"},
! 	{"958-00", "958-56"},
! 	{"958-57000", "958-59999"},
  	{"958-600", "958-799"},
  	{"958-8000", "958-9499"},
  	{"958-95000", "958-99999"},
  	{"959-00", "959-19"},
  	{"959-200", "959-699"},
  	{"959-7000", "959-8499"},
+ 	{"959-85000", "959-99999"},
  	{"960-00", "960-19"},
  	{"960-200", "960-659"},
  	{"960-6600", "960-6899"},
  	{"960-690", "960-699"},
  	{"960-7000", "960-8499"},
! 	{"960-85000", "960-92999"},
! 	{"960-93", "960-93"},
! 	{"960-9400", "960-9799"},
! 	{"960-98000", "960-99999"},
  	{"961-00", "961-19"},
  	{"961-200", "961-599"},
  	{"961-6000", "961-8999"},
***************
*** 263,274 ****
  	{"965-200", "965-599"},
  	{"965-7000", "965-7999"},
  	{"965-90000", "965-99999"},
! 	{"966-00", "966-28"},
! 	{"966-2900", "966-2999"},
  	{"966-300", "966-699"},
  	{"966-7000", "966-8999"},
  	{"966-90000", "966-99999"},
! 	{"967-0", "967-5"},
  	{"967-60", "967-89"},
  	{"967-900", "967-989"},
  	{"967-9900", "967-9989"},
--- 365,380 ----
  	{"965-200", "965-599"},
  	{"965-7000", "965-7999"},
  	{"965-90000", "965-99999"},
! 	{"966-00", "966-14"},
! 	{"966-1500", "966-1699"},
! 	{"966-170", "966-199"},
! 	{"966-2000", "966-2999"},
  	{"966-300", "966-699"},
  	{"966-7000", "966-8999"},
  	{"966-90000", "966-99999"},
! 	{"967-00", "967-29"},
! 	{"967-300", "967-499"},
! 	{"967-5000", "967-5999"},
  	{"967-60", "967-89"},
  	{"967-900", "967-989"},
  	{"967-9900", "967-9989"},
***************
*** 287,307 ****
  	{"970-9000", "970-9099"},
  	{"970-91000", "970-96999"},
  	{"970-9700", "970-9999"},
! 	{"971-000", "971-019"},
  	{"971-02", "971-02"},
  	{"971-0300", "971-0599"},
  	{"971-06", "971-09"},
  	{"971-10", "971-49"},
  	{"971-500", "971-849"},
  	{"971-8500", "971-9099"},
! 	{"971-91000", "971-99999"},
  	{"972-0", "972-1"},
  	{"972-20", "972-54"},
  	{"972-550", "972-799"},
  	{"972-8000", "972-9499"},
  	{"972-95000", "972-99999"},
  	{"973-0", "973-0"},
! 	{"973-100", "973-199"},
  	{"973-20", "973-54"},
  	{"973-550", "973-759"},
  	{"973-7600", "973-8499"},
--- 393,416 ----
  	{"970-9000", "970-9099"},
  	{"970-91000", "970-96999"},
  	{"970-9700", "970-9999"},
! 	{"971-000", "971-015"},
! 	{"971-0160", "971-0199"},
  	{"971-02", "971-02"},
  	{"971-0300", "971-0599"},
  	{"971-06", "971-09"},
  	{"971-10", "971-49"},
  	{"971-500", "971-849"},
  	{"971-8500", "971-9099"},
! 	{"971-91000", "971-98999"},
! 	{"971-9900", "971-9999"},
  	{"972-0", "972-1"},
  	{"972-20", "972-54"},
  	{"972-550", "972-799"},
  	{"972-8000", "972-9499"},
  	{"972-95000", "972-99999"},
  	{"973-0", "973-0"},
! 	{"973-100", "973-169"},
! 	{"973-1700", "973-1999"},
  	{"973-20", "973-54"},
  	{"973-550", "973-759"},
  	{"973-7600", "973-8499"},
***************
*** 315,321 ****
  	{"974-90000", "974-94999"},
  	{"974-9500", "974-9999"},
  	{"975-00000", "975-00999"},
! 	{"975-01", "975-24"},
  	{"975-250", "975-599"},
  	{"975-6000", "975-9199"},
  	{"975-92000", "975-98999"},
--- 424,431 ----
  	{"974-90000", "974-94999"},
  	{"974-9500", "974-9999"},
  	{"975-00000", "975-00999"},
! 	{"975-01", "975-01"},
! 	{"975-02", "975-24"},
  	{"975-250", "975-599"},
  	{"975-6000", "975-9199"},
  	{"975-92000", "975-98999"},
***************
*** 345,361 ****
  	{"980-00", "980-19"},
  	{"980-200", "980-599"},
  	{"980-6000", "980-9999"},
! 	{"981-00", "981-19"},
! 	{"981-200", "981-299"},
! 	{"981-3000", "981-9999"},
  	{"982-00", "982-09"},
  	{"982-100", "982-699"},
  	{"982-70", "982-89"},
! 	{"982-9000", "982-9999"},
  	{"983-00", "983-01"},
  	{"983-020", "983-199"},
  	{"983-2000", "983-3999"},
! 	{"983-40000", "983-49999"},
  	{"983-50", "983-79"},
  	{"983-800", "983-899"},
  	{"983-9000", "983-9899"},
--- 455,474 ----
  	{"980-00", "980-19"},
  	{"980-200", "980-599"},
  	{"980-6000", "980-9999"},
! 	{"981-00", "981-11"},
! 	{"981-1200", "981-1999"},
! 	{"981-200", "981-289"},
! 	{"981-2900", "981-9999"},
  	{"982-00", "982-09"},
  	{"982-100", "982-699"},
  	{"982-70", "982-89"},
! 	{"982-9000", "982-9799"},
! 	{"982-98000", "982-99999"},
  	{"983-00", "983-01"},
  	{"983-020", "983-199"},
  	{"983-2000", "983-3999"},
! 	{"983-40000", "983-44999"},
! 	{"983-45", "983-49"},
  	{"983-50", "983-79"},
  	{"983-800", "983-899"},
  	{"983-9000", "983-9899"},
***************
*** 379,385 ****
  	{"987-500", "987-899"},
  	{"987-9000", "987-9499"},
  	{"987-95000", "987-99999"},
! 	{"988-00", "988-19"},
  	{"988-200", "988-799"},
  	{"988-8000", "988-9699"},
  	{"988-97000", "988-99999"},
--- 492,499 ----
  	{"987-500", "987-899"},
  	{"987-9000", "987-9499"},
  	{"987-95000", "987-99999"},
! 	{"988-00", "988-16"},
! 	{"988-17000", "988-19999"},
  	{"988-200", "988-799"},
  	{"988-8000", "988-9699"},
  	{"988-97000", "988-99999"},
***************
*** 388,400 ****
  	{"989-550", "989-799"},
  	{"989-8000", "989-9499"},
  	{"989-95000", "989-99999"},
! 	{"9944-0", "9944-2"},
! 	{"9944-300", "9944-499"},
  	{"9944-5000", "9944-5999"},
! 	{"9944-60", "9944-89"},
  	{"9944-900", "9944-999"},
! 	{"9945-00", "9945-39"},
! 	{"9945-400", "9945-849"},
  	{"9945-8500", "9945-9999"},
  	{"9946-0", "9946-1"},
  	{"9946-20", "9946-39"},
--- 502,580 ----
  	{"989-550", "989-799"},
  	{"989-8000", "989-9499"},
  	{"989-95000", "989-99999"},
! 	{"9927-00", "9927-09"},
! 	{"9927-100", "9927-399"},
! 	{"9927-4000", "9927-4999"},
! 	{"9928-00", "9928-09"},
! 	{"9928-100", "9928-399"},
! 	{"9928-4000", "9928-4999"},
! 	{"9929-0", "9929-3"},
! 	{"9929-40", "9929-54"},
! 	{"9929-550", "9929-799"},
! 	{"9929-8000", "9929-9999"},
! 	{"9930-00", "9930-49"},
! 	{"9930-500", "9930-939"},
! 	{"9930-9400", "9930-9999"},
! 	{"9931-00", "9931-29"},
! 	{"9931-300", "9931-899"},
! 	{"9931-9000", "9931-9999"},
! 	{"9932-00", "9932-39"},
! 	{"9932-400", "9932-849"},
! 	{"9932-8500", "9932-9999"},
! 	{"9933-0", "9933-0"},
! 	{"9933-10", "9933-39"},
! 	{"9933-400", "9933-899"},
! 	{"9933-9000", "9933-9999"},
! 	{"9934-0", "9934-0"},
! 	{"9934-10", "9934-49"},
! 	{"9934-500", "9934-799"},
! 	{"9934-8000", "9934-9999"},
! 	{"9935-0", "9935-0"},
! 	{"9935-10", "9935-39"},
! 	{"9935-400", "9935-899"},
! 	{"9935-9000", "9935-9999"},
! 	{"9936-0", "9936-1"},
! 	{"9936-20", "9936-39"},
! 	{"9936-400", "9936-799"},
! 	{"9936-8000", "9936-9999"},
! 	{"9937-0", "9937-2"},
! 	{"9937-30", "9937-49"},
! 	{"9937-500", "9937-799"},
! 	{"9937-8000", "9937-9999"},
! 	{"9938-00", "9938-79"},
! 	{"9938-800", "9938-949"},
! 	{"9938-9500", "9938-9999"},
! 	{"9939-0", "9939-4"},
! 	{"9939-50", "9939-79"},
! 	{"9939-800", "9939-899"},
! 	{"9939-9000", "9939-9999"},
! 	{"9940-0", "9940-1"},
! 	{"9940-20", "9940-49"},
! 	{"9940-500", "9940-899"},
! 	{"9940-9000", "9940-9999"},
! 	{"9941-0", "9941-0"},
! 	{"9941-10", "9941-39"},
! 	{"9941-400", "9941-899"},
! 	{"9941-9000", "9941-9999"},
! 	{"9942-00", "9942-89"},
! 	{"9942-900", "9942-994"},
! 	{"9942-9950", "9942-9999"},
! 	{"9943-00", "9943-29"},
! 	{"9943-300", "9943-399"},
! 	{"9943-4000", "9943-9999"},
! 	{"9944-0000", "9944-0999"},
! 	{"9944-100", "9944-499"},
  	{"9944-5000", "9944-5999"},
! 	{"9944-60", "9944-69"},
! 	{"9944-700", "9944-799"},
! 	{"9944-80", "9944-89"},
  	{"9944-900", "9944-999"},
! 	{"9945-00", "9945-00"},
! 	{"9945-010", "9945-079"},
! 	{"9945-08", "9945-39"},
! 	{"9945-400", "9945-569"},
! 	{"9945-57", "9945-57"},
! 	{"9945-580", "9945-849"},
  	{"9945-8500", "9945-9999"},
  	{"9946-0", "9946-1"},
  	{"9946-20", "9946-39"},
***************
*** 437,444 ****
  	{"9956-400", "9956-899"},
  	{"9956-9000", "9956-9999"},
  	{"9957-00", "9957-39"},
! 	{"9957-400", "9957-849"},
! 	{"9957-8500", "9957-9999"},
  	{"9958-0", "9958-0"},
  	{"9958-10", "9958-49"},
  	{"9958-500", "9958-899"},
--- 617,626 ----
  	{"9956-400", "9956-899"},
  	{"9956-9000", "9956-9999"},
  	{"9957-00", "9957-39"},
! 	{"9957-400", "9957-699"},
! 	{"9957-70", "9957-84"},
! 	{"9957-8500", "9957-8799"},
! 	{"9957-88", "9957-99"},
  	{"9958-0", "9958-0"},
  	{"9958-10", "9958-49"},
  	{"9958-500", "9958-899"},
***************
*** 461,467 ****
  	{"9962-8500", "9962-9999"},
  	{"9963-0", "9963-2"},
  	{"9963-30", "9963-54"},
! 	{"9963-550", "9963-749"},
  	{"9963-7500", "9963-9999"},
  	{"9964-0", "9964-6"},
  	{"9964-70", "9964-94"},
--- 643,650 ----
  	{"9962-8500", "9962-9999"},
  	{"9963-0", "9963-2"},
  	{"9963-30", "9963-54"},
! 	{"9963-550", "9963-734"},
! 	{"9963-7350", "9963-7499"},
  	{"9963-7500", "9963-9999"},
  	{"9964-0", "9964-6"},
  	{"9964-70", "9964-94"},
***************
*** 469,475 ****
  	{"9965-00", "9965-39"},
  	{"9965-400", "9965-899"},
  	{"9965-9000", "9965-9999"},
! 	{"9966-00", "9966-69"},
  	{"9966-7000", "9966-7499"},
  	{"9966-750", "9966-959"},
  	{"9966-9600", "9966-9999"},
--- 652,659 ----
  	{"9965-00", "9965-39"},
  	{"9965-400", "9965-899"},
  	{"9965-9000", "9965-9999"},
! 	{"9966-000", "9966-199"},
! 	{"9966-20", "9966-69"},
  	{"9966-7000", "9966-7499"},
  	{"9966-750", "9966-959"},
  	{"9966-9600", "9966-9999"},
***************
*** 493,499 ****
  	{"9972-30", "9972-59"},
  	{"9972-600", "9972-899"},
  	{"9972-9000", "9972-9999"},
! 	{"9973-0", "9973-0"},
  	{"9973-10", "9973-69"},
  	{"9973-700", "9973-969"},
  	{"9973-9700", "9973-9999"},
--- 677,685 ----
  	{"9972-30", "9972-59"},
  	{"9972-600", "9972-899"},
  	{"9972-9000", "9972-9999"},
! 	{"9973-00", "9973-05"},
! 	{"9973-060", "9973-089"},
! 	{"9973-0900", "9973-0999"},
  	{"9973-10", "9973-69"},
  	{"9973-700", "9973-969"},
  	{"9973-9700", "9973-9999"},
***************
*** 511,517 ****
  	{"9976-0", "9976-5"},
  	{"9976-60", "9976-89"},
  	{"9976-900", "9976-989"},
! 	{"9976-9990", "9976-9999"},
  	{"9977-00", "9977-89"},
  	{"9977-900", "9977-989"},
  	{"9977-9900", "9977-9999"},
--- 697,703 ----
  	{"9976-0", "9976-5"},
  	{"9976-60", "9976-89"},
  	{"9976-900", "9976-989"},
! 	{"9976-9900", "9976-9999"},
  	{"9977-00", "9977-89"},
  	{"9977-900", "9977-989"},
  	{"9977-9900", "9977-9999"},
***************
*** 521,527 ****
  	{"9978-950", "9978-989"},
  	{"9978-9900", "9978-9999"},
  	{"9979-0", "9979-4"},
! 	{"9979-50", "9979-75"},
  	{"9979-760", "9979-899"},
  	{"9979-9000", "9979-9999"},
  	{"9980-0", "9980-3"},
--- 707,715 ----
  	{"9978-950", "9978-989"},
  	{"9978-9900", "9978-9999"},
  	{"9979-0", "9979-4"},
! 	{"9979-50", "9979-64"},
! 	{"9979-650", "9979-659"},
! 	{"9979-66", "9979-75"},
  	{"9979-760", "9979-899"},
  	{"9979-9000", "9979-9999"},
  	{"9980-0", "9980-3"},
***************
*** 581,587 ****
  	{"99906-30", "99906-59"},
  	{"99906-600", "99906-699"},
  	{"99906-70", "99906-89"},
! 	{"99906-9", "99906-9"},
  	{"99908-0", "99908-0"},
  	{"99908-10", "99908-89"},
  	{"99908-900", "99908-999"},
--- 769,776 ----
  	{"99906-30", "99906-59"},
  	{"99906-600", "99906-699"},
  	{"99906-70", "99906-89"},
! 	{"99906-90", "99906-94"},
! 	{"99906-950", "99906-999"},
  	{"99908-0", "99908-0"},
  	{"99908-10", "99908-89"},
  	{"99908-900", "99908-999"},
***************
*** 602,608 ****
  	{"99913-600", "99913-604"},
  	{"99914-0", "99914-4"},
  	{"99914-50", "99914-89"},
! 	{"99914-900", "99914-949"},
  	{"99915-0", "99915-4"},
  	{"99915-50", "99915-79"},
  	{"99915-800", "99915-999"},
--- 791,797 ----
  	{"99913-600", "99913-604"},
  	{"99914-0", "99914-4"},
  	{"99914-50", "99914-89"},
! 	{"99914-900", "99914-999"},
  	{"99915-0", "99915-4"},
  	{"99915-50", "99915-79"},
  	{"99915-800", "99915-999"},
***************
*** 616,621 ****
--- 805,811 ----
  	{"99918-40", "99918-79"},
  	{"99918-800", "99918-999"},
  	{"99919-0", "99919-2"},
+ 	{"99919-300", "99919-399"},
  	{"99919-40", "99919-69"},
  	{"99919-900", "99919-999"},
  	{"99920-0", "99920-4"},
***************
*** 632,639 ****
  	{"99923-0", "99923-1"},
  	{"99923-20", "99923-79"},
  	{"99923-800", "99923-999"},
! 	{"99924-0", "99924-2"},
! 	{"99924-30", "99924-79"},
  	{"99924-800", "99924-999"},
  	{"99925-0", "99925-3"},
  	{"99925-40", "99925-79"},
--- 822,829 ----
  	{"99923-0", "99923-1"},
  	{"99923-20", "99923-79"},
  	{"99923-800", "99923-999"},
! 	{"99924-0", "99924-1"},
! 	{"99924-20", "99924-79"},
  	{"99924-800", "99924-999"},
  	{"99925-0", "99925-3"},
  	{"99925-40", "99925-79"},
***************
*** 669,676 ****
  	{"99934-800", "99934-999"},
  	{"99935-0", "99935-2"},
  	{"99935-30", "99935-59"},
! 	{"99935-600", "99935-799"},
! 	{"99935-8", "99935-8"},
  	{"99935-90", "99935-99"},
  	{"99936-0", "99936-0"},
  	{"99936-10", "99936-59"},
--- 859,866 ----
  	{"99934-800", "99934-999"},
  	{"99935-0", "99935-2"},
  	{"99935-30", "99935-59"},
! 	{"99935-600", "99935-699"},
! 	{"99935-7", "99935-8"},
  	{"99935-90", "99935-99"},
  	{"99936-0", "99936-0"},
  	{"99936-10", "99936-59"},
***************
*** 689,696 ****
  	{"99940-10", "99940-69"},
  	{"99940-700", "99940-999"},
  	{"99941-0", "99941-2"},
! 	{"99941-30", "99941-89"},
! 	{"99941-900", "99941-999"},
  	{"99942-0", "99942-4"},
  	{"99942-50", "99942-79"},
  	{"99942-800", "99942-999"},
--- 879,886 ----
  	{"99940-10", "99940-69"},
  	{"99940-700", "99940-999"},
  	{"99941-0", "99941-2"},
! 	{"99941-30", "99941-79"},
! 	{"99941-800", "99941-999"},
  	{"99942-0", "99942-4"},
  	{"99942-50", "99942-79"},
  	{"99942-800", "99942-999"},
***************
*** 718,732 ****
  	{"99950-0", "99950-4"},
  	{"99950-50", "99950-79"},
  	{"99950-800", "99950-999"},
- 	{"99951-00", "99951-99"},
  	{"99952-0", "99952-4"},
  	{"99952-50", "99952-79"},
  	{"99952-800", "99952-999"},
  	{"99953-0", "99953-2"},
  	{"99953-30", "99953-79"},
! 	{"99953-800", "99953-999"},
  	{"99954-0", "99954-2"},
  	{"99954-30", "99954-69"},
  	{"99954-700", "99954-999"},
  	{NULL, NULL},
  };
--- 908,991 ----
  	{"99950-0", "99950-4"},
  	{"99950-50", "99950-79"},
  	{"99950-800", "99950-999"},
  	{"99952-0", "99952-4"},
  	{"99952-50", "99952-79"},
  	{"99952-800", "99952-999"},
  	{"99953-0", "99953-2"},
  	{"99953-30", "99953-79"},
! 	{"99953-800", "99953-939"},
! 	{"99953-94", "99953-99"},
  	{"99954-0", "99954-2"},
  	{"99954-30", "99954-69"},
  	{"99954-700", "99954-999"},
+ 	{"99955-0", "99955-1"},
+ 	{"99955-20", "99955-59"},
+ 	{"99955-600", "99955-799"},
+ 	{"99955-80", "99955-89"},
+ 	{"99955-90", "99955-99"},
+ 	{"99956-00", "99956-59"},
+ 	{"99956-600", "99956-859"},
+ 	{"99956-86", "99956-99"},
+ 	{"99957-0", "99957-1"},
+ 	{"99957-20", "99957-79"},
+ 	{"99957-800", "99957-999"},
+ 	{"99958-0", "99958-4"},
+ 	{"99958-50", "99958-94"},
+ 	{"99958-950", "99958-999"},
+ 	{"99959-0", "99959-2"},
+ 	{"99959-30", "99959-59"},
+ 	{"99959-600", "99959-999"},
+ 	{"99960-0", "99960-0"},
+ 	{"99960-10", "99960-94"},
+ 	{"99960-950", "99960-999"},
+ 	{"99961-0", "99961-3"},
+ 	{"99961-40", "99961-89"},
+ 	{"99961-900", "99961-999"},
+ 	{"99962-0", "99962-4"},
+ 	{"99962-50", "99962-79"},
+ 	{"99962-800", "99962-999"},
+ 	{"99963-00", "99963-49"},
+ 	{"99963-500", "99963-999"},
+ 	{"99964-0", "99964-1"},
+ 	{"99964-20", "99964-79"},
+ 	{"99964-800", "99964-999"},
+ 	{"99965-0", "99965-3"},
+ 	{"99965-40", "99965-79"},
+ 	{"99965-800", "99965-999"},
+ 	{"99966-0", "99966-2"},
+ 	{"99966-30", "99966-69"},
+ 	{"99966-700", "99966-799"},
+ 	{"99967-0", "99967-1"},
+ 	{"99967-20", "99967-59"},
+ 	{"99967-600", "99967-899"},
  	{NULL, NULL},
  };
+ 
+ /*
+  * For ISBN with prefix 979
+  * Range Table as of 2010-Jul-29
+  */
+ 
+ /* where the digit set begins, and how many of them are in the table */
+ const unsigned ISBN_index_new[10][2] = {
+ 	{0, 0},
+ 	{0, 5},
+ 	{5, 0},
+ 	{5, 0},
+ 	{5, 0},
+ 	{5, 0},
+ 	{5, 0},
+ 	{5, 0},
+ 	{5, 0},
+ 	{5, 0},
+ };
+ 
+ const char *ISBN_range_new[][2] = {
+ 	{"10-00", "10-19"},
+ 	{"10-200", "10-699"},
+ 	{"10-7000", "10-8999"},
+ 	{"10-90000", "10-97599"},
+ 	{"10-976000", "10-999999"},
+ 	{NULL, NULL},
+ };
+ 
Index: contrib/isn/isn.c
===================================================================
RCS file: /Users/asche/Projects/Repositories/postgresql/pgsql/contrib/isn/isn.c,v
retrieving revision 1.14
diff -c -c -r1.14 isn.c
*** contrib/isn/isn.c	26 Feb 2010 02:00:32 -0000	1.14
--- contrib/isn/isn.c	4 Aug 2010 16:58:22 -0000
***************
*** 7,13 ****
   * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
   *
   * IDENTIFICATION
!  *	  $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.13 2010/02/05 04:34:51 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 7,13 ----
   * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
   *
   * IDENTIFICATION
!  *	  $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.14 2010/02/26 02:00:32 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 573,579 ****
  
  	/* find out what type of hyphenation is needed: */
  	if (!strncmp("978-", result, search))
! 	{							/* ISBN */
  		/* The string should be in this form: 978-??000000000-0" */
  		type = ISBN;
  		TABLE = ISBN_range;
--- 573,579 ----
  
  	/* find out what type of hyphenation is needed: */
  	if (!strncmp("978-", result, search))
! 	{							/* ISBN -13 978-range */
  		/* The string should be in this form: 978-??000000000-0" */
  		type = ISBN;
  		TABLE = ISBN_range;
***************
*** 593,598 ****
--- 593,605 ----
  		TABLE = ISMN_range;
  		TABLE_index = ISMN_index;
  	}
+ 	else if (!strncmp("979-", result, search))
+ 	{							/* ISBN-13 979-range */
+ 		/* The string should be in this form: 979-??000000000-0" */
+ 		type = ISBN;
+ 		TABLE = ISBN_range_new;
+ 		TABLE_index = ISBN_index_new;
+ 	}
  	else if (*result == '0')
  	{							/* UPC */
  		/* The string should be in this form: 000-00000000000-0" */
#2Joshua D. Drake
jd@commandprompt.com
In reply to: Jan Otto (#1)
Re: patch for contrib/isn

On Wed, 2010-08-04 at 19:32 +0200, Jan Otto wrote:

hi all,

currently i am working on a big project for a german bookseller and
publisher. one of the requirements was correct hyphenation of ISBN-13
for about 14.400.000 books in postgresql database. so added support
for hyphenating isbn with the new 979-prefix and additionally added all
missing ranges since year 2006 for isbn with 978-prefix.

patch against HEAD is attached and validated against a lot of previously
wrong and correct hyphenated isbn.

regards, jan

Great! Thanks. We will get it on the review list.

Joshua D. Drake

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

#3Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Joshua D. Drake (#2)
Re: patch for contrib/isn

"Joshua D. Drake" <jd@commandprompt.com> wrote:

On Wed, 2010-08-04 at 19:32 +0200, Jan Otto wrote:

patch against HEAD is attached and validated against a lot of
previously wrong and correct hyphenated isbn.

Great! Thanks. We will get it on the review list.

I added it as "isbn update" to the 2010-09 CommitFest page.

-Kevin

#4Robert Haas
robertmhaas@gmail.com
In reply to: Kevin Grittner (#3)
Re: patch for contrib/isn

On Wed, Aug 4, 2010 at 2:58 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:

"Joshua D. Drake" <jd@commandprompt.com> wrote:

On Wed, 2010-08-04 at 19:32 +0200, Jan Otto wrote:

patch against HEAD is attached and validated against a lot of
previously wrong and correct hyphenated isbn.

Great! Thanks. We will get it on the review list.

I added it as "isbn update" to the 2010-09 CommitFest page.

Please put "contrib/isn" in the name somewhere so that there is some
overlap between the subject line and the CF entry. I can't tell you
how many times I've gone "oh, crud, what was the subject line for the
latest version of the \ef / \sf patch?" in the last two weeks.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

#5Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Robert Haas (#4)
Re: patch for contrib/isn

Robert Haas <robertmhaas@gmail.com> wrote:

Please put "contrib/isn" in the name somewhere so that there is
some overlap between the subject line and the CF entry.

It is now "contrib/isn isbn update".

-Kevin

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Jan Otto (#1)
Re: patch for contrib/isn

On ons, 2010-08-04 at 19:32 +0200, Jan Otto wrote:

patch against HEAD is attached and validated against a lot of
previously wrong and correct hyphenated isbn.

I think this module could use a regression test.

#7Jan Otto
asche@me.com
In reply to: Peter Eisentraut (#6)
Re: patch for contrib/isn

On Aug 6, 2010, at 11:08 PM, Peter Eisentraut wrote:

On ons, 2010-08-04 at 19:32 +0200, Jan Otto wrote:

patch against HEAD is attached and validated against a lot of
previously wrong and correct hyphenated isbn.

I think this module could use a regression test.

i'll take a look at this within next days.

regards, jan