id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 5125,PostgreSQL primary key name exceeds name limit,strk,warmerdam,"When asked to create a table with a name of 63 characters (postgresql name limit) ogr2ogr adds a PRIMARY KEY constraint with a name that is derived from the table name with 3 characters appended (""_pk""). PostgreSQL truncates those 3 characters from the constraint name, to get it within limits, and the result is an error due to the fact that a relation with the given name already exists (a primary key creates an index which is a relation): See session for detail: {{{ ""ERROR 1: CREATE TABLE \""public\"".\""sql_filename_manutenzione2009_q_select_from_manutenzione2009_fo\"" ( \""cartodb_id\"" SERIAL, CONSTRAINT \""sql_filename_manutenzione2009_q_select_from_manutenzione2009_fo_pk\"" PRIMARY KEY (\""cartodb_id\"") ) ERROR: relation \""sql_filename_manutenzione2009_q_select_from_manutenzione2009_fo\"" already exists ERROR 1: Terminating translation prematurely after failed\ntranslation of layer sql_filename_manutenzione2009_q_select_from_manutenzione2009_fo20130620-29277-1vedg2r (use -skipfailures to skip errors) }}} Omitting the primary key name and letting PostgreSQL decide over it succeeds as pgsql truncates the name to take into account the suffix (it adds _pkey as a suffix). See this pgsql session: {{{ strk=# CREATE TABLE ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" ( a int, constraint ""a123456789b12345678c123456789d123456789e123456789f123456789g123_pl"" primary key (a) ); NOTICE: identifier ""a123456789b12345678c123456789d123456789e123456789f123456789g123_pl"" will be truncated to ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" for table ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" ERROR: relation ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" already exists strk=# CREATE TABLE ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" ( a int, primary key (a) );NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index ""a123456789b12345678c123456789d123456789e123456789f12345678_pkey"" for table ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" DEBUG: building index ""a123456789b12345678c123456789d123456789e123456789f12345678_pkey"" on table ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" LOG: duration: 212.168 ms statement: CREATE TABLE ""a123456789b12345678c123456789d123456789e123456789f123456789g123"" ( a int, primary key (a) ); CREATE TABLE }}}",defect,closed,normal,1.10.1,OGR_SF,unspecified,normal,fixed,postgres postgis,