Server IP : 103.119.228.120 / Your IP : 18.117.145.67 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/postgresql-9.2.24/html/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >isn</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.2.24 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Additional Supplied Modules" HREF="contrib.html"><LINK REL="PREVIOUS" TITLE="intarray" HREF="intarray.html"><LINK REL="NEXT" TITLE="lo" HREF="lo.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2017-11-06T22:43:11"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.2.24 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="intarray" HREF="intarray.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="contrib.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Appendix F. Additional Supplied Modules</TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="lo" HREF="lo.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="ISN" >F.19. isn</A ></H1 ><P > The <TT CLASS="FILENAME" >isn</TT > module provides data types for the following international product numbering standards: EAN13, UPC, ISBN (books), ISMN (music), and ISSN (serials). Numbers are validated on input according to a hard-coded list of prefixes; this list of prefixes is also used to hyphenate numbers on output. Since new prefixes are assigned from time to time, the list of prefixes may be out of date. It is hoped that a future version of this module will obtained the prefix list from one or more tables that can be easily updated by users as needed; however, at present, the list can only be updated by modifying the source code and recompiling. Alternatively, prefix validation and hyphenation support may be dropped from a future version of this module. </P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN149147" >F.19.1. Data Types</A ></H2 ><P > <A HREF="isn.html#ISN-DATATYPES" >Table F-12</A > shows the data types provided by the <TT CLASS="FILENAME" >isn</TT > module. </P ><DIV CLASS="TABLE" ><A NAME="ISN-DATATYPES" ></A ><P ><B >Table F-12. <TT CLASS="FILENAME" >isn</TT > Data Types</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Data Type</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="TYPE" >EAN13</TT ></TD ><TD > European Article Numbers, always displayed in the EAN13 display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >ISBN13</TT ></TD ><TD > International Standard Book Numbers to be displayed in the new EAN13 display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >ISMN13</TT ></TD ><TD > International Standard Music Numbers to be displayed in the new EAN13 display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >ISSN13</TT ></TD ><TD > International Standard Serial Numbers to be displayed in the new EAN13 display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >ISBN</TT ></TD ><TD > International Standard Book Numbers to be displayed in the old short display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >ISMN</TT ></TD ><TD > International Standard Music Numbers to be displayed in the old short display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >ISSN</TT ></TD ><TD > International Standard Serial Numbers to be displayed in the old short display format </TD ></TR ><TR ><TD ><TT CLASS="TYPE" >UPC</TT ></TD ><TD > Universal Product Codes </TD ></TR ></TBODY ></TABLE ></DIV ><P > Some notes: </P ><P ></P ><OL TYPE="1" ><LI ><P >ISBN13, ISMN13, ISSN13 numbers are all EAN13 numbers.</P ></LI ><LI ><P >EAN13 numbers aren't always ISBN13, ISMN13 or ISSN13 (some are).</P ></LI ><LI ><P >Some ISBN13 numbers can be displayed as ISBN.</P ></LI ><LI ><P >Some ISMN13 numbers can be displayed as ISMN.</P ></LI ><LI ><P >Some ISSN13 numbers can be displayed as ISSN.</P ></LI ><LI ><P >UPC numbers are a subset of the EAN13 numbers (they are basically EAN13 without the first <TT CLASS="LITERAL" >0</TT > digit).</P ></LI ><LI ><P >All UPC, ISBN, ISMN and ISSN numbers can be represented as EAN13 numbers.</P ></LI ></OL ><P > Internally, all these types use the same representation (a 64-bit integer), and all are interchangeable. Multiple types are provided to control display formatting and to permit tighter validity checking of input that is supposed to denote one particular type of number. </P ><P > The <TT CLASS="TYPE" >ISBN</TT >, <TT CLASS="TYPE" >ISMN</TT >, and <TT CLASS="TYPE" >ISSN</TT > types will display the short version of the number (ISxN 10) whenever it's possible, and will show ISxN 13 format for numbers that do not fit in the short version. The <TT CLASS="TYPE" >EAN13</TT >, <TT CLASS="TYPE" >ISBN13</TT >, <TT CLASS="TYPE" >ISMN13</TT > and <TT CLASS="TYPE" >ISSN13</TT > types will always display the long version of the ISxN (EAN13). </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN149219" >F.19.2. Casts</A ></H2 ><P > The <TT CLASS="FILENAME" >isn</TT > module provides the following pairs of type casts: </P ><P ></P ><UL ><LI ><P > ISBN13 <=> EAN13 </P ></LI ><LI ><P > ISMN13 <=> EAN13 </P ></LI ><LI ><P > ISSN13 <=> EAN13 </P ></LI ><LI ><P > ISBN <=> EAN13 </P ></LI ><LI ><P > ISMN <=> EAN13 </P ></LI ><LI ><P > ISSN <=> EAN13 </P ></LI ><LI ><P > UPC <=> EAN13 </P ></LI ><LI ><P > ISBN <=> ISBN13 </P ></LI ><LI ><P > ISMN <=> ISMN13 </P ></LI ><LI ><P > ISSN <=> ISSN13 </P ></LI ></UL ><P > When casting from <TT CLASS="TYPE" >EAN13</TT > to another type, there is a run-time check that the value is within the domain of the other type, and an error is thrown if not. The other casts are simply relabelings that will always succeed. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN149246" >F.19.3. Functions and Operators</A ></H2 ><P > The <TT CLASS="FILENAME" >isn</TT > module provides the standard comparison operators, plus B-tree and hash indexing support for all these data types. In addition there are several specialized functions; shown in <A HREF="isn.html#ISN-FUNCTIONS" >Table F-13</A >. In this table, <TT CLASS="TYPE" >isn</TT > means any one of the module's data types. </P ><DIV CLASS="TABLE" ><A NAME="ISN-FUNCTIONS" ></A ><P ><B >Table F-13. <TT CLASS="FILENAME" >isn</TT > Functions</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Function</TH ><TH >Returns</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ><CODE CLASS="FUNCTION" >isn_weak(boolean)</CODE ></TD ><TD ><TT CLASS="TYPE" >boolean</TT ></TD ><TD >Sets the weak input mode (returns new setting)</TD ></TR ><TR ><TD ><CODE CLASS="FUNCTION" >isn_weak()</CODE ></TD ><TD ><TT CLASS="TYPE" >boolean</TT ></TD ><TD >Gets the current status of the weak mode</TD ></TR ><TR ><TD ><CODE CLASS="FUNCTION" >make_valid(isn)</CODE ></TD ><TD ><TT CLASS="TYPE" >isn</TT ></TD ><TD >Validates an invalid number (clears the invalid flag)</TD ></TR ><TR ><TD ><CODE CLASS="FUNCTION" >is_valid(isn)</CODE ></TD ><TD ><TT CLASS="TYPE" >boolean</TT ></TD ><TD >Checks for the presence of the invalid flag</TD ></TR ></TBODY ></TABLE ></DIV ><P > <I CLASS="FIRSTTERM" >Weak</I > mode is used to be able to insert invalid data into a table. Invalid means the check digit is wrong, not that there are missing numbers. </P ><P > Why would you want to use the weak mode? Well, it could be that you have a huge collection of ISBN numbers, and that there are so many of them that for weird reasons some have the wrong check digit (perhaps the numbers were scanned from a printed list and the OCR got the numbers wrong, perhaps the numbers were manually captured... who knows). Anyway, the point is you might want to clean the mess up, but you still want to be able to have all the numbers in your database and maybe use an external tool to locate the invalid numbers in the database so you can verify the information and validate it more easily; so for example you'd want to select all the invalid numbers in the table. </P ><P > When you insert invalid numbers in a table using the weak mode, the number will be inserted with the corrected check digit, but it will be displayed with an exclamation mark (<TT CLASS="LITERAL" >!</TT >) at the end, for example <TT CLASS="LITERAL" >0-11-000322-5!</TT >. This invalid marker can be checked with the <CODE CLASS="FUNCTION" >is_valid</CODE > function and cleared with the <CODE CLASS="FUNCTION" >make_valid</CODE > function. </P ><P > You can also force the insertion of invalid numbers even when not in the weak mode, by appending the <TT CLASS="LITERAL" >!</TT > character at the end of the number. </P ><P > Another special feature is that during input, you can write <TT CLASS="LITERAL" >?</TT > in place of the check digit, and the correct check digit will be inserted automatically. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN149298" >F.19.4. Examples</A ></H2 ><PRE CLASS="PROGRAMLISTING" >--Using the types directly: SELECT isbn('978-0-393-04002-9'); SELECT isbn13('0901690546'); SELECT issn('1436-4522'); --Casting types: -- note that you can only cast from ean13 to another type when the -- number would be valid in the realm of the target type; -- thus, the following will NOT work: select isbn(ean13('0220356483481')); -- but these will: SELECT upc(ean13('0220356483481')); SELECT ean13(upc('220356483481')); --Create a table with a single column to hold ISBN numbers: CREATE TABLE test (id isbn); INSERT INTO test VALUES('9780393040029'); --Automatically calculate check digits (observe the '?'): INSERT INTO test VALUES('220500896?'); INSERT INTO test VALUES('978055215372?'); SELECT issn('3251231?'); SELECT ismn('979047213542?'); --Using the weak mode: SELECT isn_weak(true); INSERT INTO test VALUES('978-0-11-000533-4'); INSERT INTO test VALUES('9780141219307'); INSERT INTO test VALUES('2-205-00876-X'); SELECT isn_weak(false); SELECT id FROM test WHERE NOT is_valid(id); UPDATE test SET id = make_valid(id) WHERE id = '2-205-00876-X!'; SELECT * FROM test; SELECT isbn13(id) FROM test;</PRE ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN149301" >F.19.5. Bibliography</A ></H2 ><P > The information to implement this module was collected from several sites, including: <P ></P ></P><UL ><LI ><P ><A HREF="http://www.isbn-international.org/" TARGET="_top" >http://www.isbn-international.org/</A ></P ></LI ><LI ><P ><A HREF="http://www.issn.org/" TARGET="_top" >http://www.issn.org/</A ></P ></LI ><LI ><P ><A HREF="http://www.ismn-international.org/" TARGET="_top" >http://www.ismn-international.org/</A ></P ></LI ><LI ><P ><A HREF="http://www.wikipedia.org/" TARGET="_top" >http://www.wikipedia.org/</A ></P ></LI ></UL ><P> The prefixes used for hyphenation were also compiled from: <P ></P ></P><UL ><LI ><P ><A HREF="http://www.gs1.org/productssolutions/idkeys/support/prefix_list.html" TARGET="_top" >http://www.gs1.org/productssolutions/idkeys/support/prefix_list.html</A ></P ></LI ><LI ><P ><A HREF="http://www.isbn-international.org/en/identifiers.html" TARGET="_top" >http://www.isbn-international.org/en/identifiers.html</A ></P ></LI ><LI ><P ><A HREF="http://www.ismn-international.org/ranges.html" TARGET="_top" >http://www.ismn-international.org/ranges.html</A ></P ></LI ></UL ><P> Care was taken during the creation of the algorithms and they were meticulously verified against the suggested algorithms in the official ISBN, ISMN, ISSN User Manuals. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN149327" >F.19.6. Author</A ></H2 ><P > Germán Méndez Bravo (Kronuz), 2004 - 2006 </P ><P > This module was inspired by Garrett A. Wollman's <TT CLASS="FILENAME" >isbn_issn</TT > code. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="intarray.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="lo.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >intarray</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="contrib.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >lo</TD ></TR ></TABLE ></DIV ></BODY ></HTML >