[postgis-devel] [PostGIS] #1008: Too many columns in select crashes pgsql2shp

PostGIS trac at osgeo.org
Wed Jun 8 12:53:15 PDT 2011


#1008: Too many columns in select crashes pgsql2shp
---------------------------+------------------------------------------------
 Reporter:  joshjordan     |       Owner:  mcayland     
     Type:  defect         |      Status:  new          
 Priority:  medium         |   Milestone:  PostGIS 2.0.0
Component:  loader/dumper  |     Version:  trunk        
 Keywords:  pgsql2shp      |  
---------------------------+------------------------------------------------

Comment(by aperi2007):

 I can partially confirm it.

 the specs of dbf wrote:

 {{{
 *************************************************************************
 The data file header structure for dBASE IV 2.0 table file.
 **************************************************************************

 File Structure:
 ===============

 Byte     Contents       Meaning
 -------  ----------     -------------------------------------------------
 0        1byte          Valid dBASE IV file; bits 0-2 indicate version
                         number, bit 3 the presence of a dBASE IV memo
                         file, bits 4-6 the presence of an SQL table, bit
                         7 the presence of any memo file (either dBASE III
                         PLUS or dBASE IV).
 1-3      3 bytes        Date of last update; formattted as YYMMDD.
 4-7      32-bit number  Number of records in the file.
 8-9      16-bit number  Number of bytes in the header.
 10-11    16-bit number  Number of bytes in the record.
 12-13    2 bytes        Reserved; fill with 0.
 14       1 byte         Flag indicating incomplete transaction.
 15       1 byte         Encryption flag.
 16-27    12 bytes       Reserved for dBASE IV in a multi-user environment.
 28       1 bytes        Production MDX file flag; 01H if there is an MDX,
                         00H if not.
 29       1 byte         Language driver ID.
 30-31    2 bytes        Reserved; fill with 0.
 32-n*    32 bytes each  Field descriptor array (see below).
 n + 1    1 byte         0DH as the field terminator.
 }}}

 The max number of bytes for a record are 2^16 byte = 65kbyte

 So the max is not 2048 (wrong remenber) but 65 kbyte.
 (I don't know if in the DBIII version the size can be less.)

 So if the query size is more than 65Kbyte ....

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1008#comment:4>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list