[OSM-talk] Osm2pgsql and column names with two underscores

2009-03-30 Thread Jukka Rahkonen
Hi,

An osm2pgsql user writes on the forum about importing special tags
into PostGIS.
He has defined for example these tags:
node   openGeoDB:telephone_area_code   text 
node   openGeoDB:license_plate_code  text

Import fails and error message is:
CREATE TABLE planet_osm_point ( osm_id int4,access text,
admin_level text, 

---SNIP---
openGeoDB:postal_codes text,openGeoDB:telephone_are a_code,
openGeoDB:type text,openGeoDB:license_plate _code,z_order
int4 );

failed: ERROR:  type a_code does not exist
LINE 1: ...eoDB:postal_codes text,
openGeoDB:telephone_are a_code,op...
 ^

Error occurred, cleaning up

Look at these:
openGeoDB:telephone_are a_code,
openGeoDB:license_plate _code

It looks like column name gets truncated at the second 
underline character. Could it be some bug in osm2pgsql,
or is it some other place where the error occurs?

-Jukka Rahkonen-



___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Osm2pgsql and column names with two underscores

2009-03-30 Thread Martijn van Oosterhout
On Mon, Mar 30, 2009 at 2:08 PM, Jukka Rahkonen
jukka.rahko...@mmmtike.fi wrote:
 Hi,

 An osm2pgsql user writes on the forum about importing special tags
 into PostGIS.
 He has defined for example these tags:
 node       openGeoDB:telephone_area_code       text
 node       openGeoDB:license_plate_code          text

 Import fails and error message is:
 CREATE TABLE planet_osm_point ( osm_id int4,access text,
 admin_level text,

Ok, it's got nothing to do with the underscores and more to do with
the fact that the field names are limited to 23 characters by
osm2pgsql. I don't really know where this restriction comes from, does
anyone else have ideas?

It should be easy to fix in output-pgsql.c. Fix the read_style_file()
function to increase the length of the buffers.

Have a nice day,
-- 
Martijn van Oosterhout klep...@gmail.com http://svana.org/kleptog/

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Osm2pgsql and column names with two underscores

2009-03-30 Thread sly (sylvain letuffe)
On Monday 30 March 2009 14:08, Jukka Rahkonen wrote:
 Hi,

Hi,

( better transfert this to dev ?)


 An osm2pgsql user writes on the forum about importing special tags
 into PostGIS.
 He has defined for example these tags:
 node   openGeoDB:telephone_area_code   text 
 node   openGeoDB:license_plate_code  text

I've read his problem, and proposed converting the osm input file with smaller 
tag name. The other solution might be to patch osm2pgsql.

 Look at these:
 openGeoDB:telephone_are a_code,
 openGeoDB:license_plate _code
 
 It looks like column name gets truncated at the second 
 underline character. 

Coincidence ;-)

Both tag name are also truncated at 24 chars exactly, let's see...

 Could it be some bug in osm2pgsql, 
 or is it some other place where the error occurs?

Looks like I went lucky :
# grep 24 output-pgsql.c
char buffer[1024];
  char buffer[1024];
char osmtype[24];
char tag[24];
char datatype[24];

Recompiling osm2pgsql might help, if that limit of 24 is not present elsewhere


-- 
sly 
Sylvain Letuffe li...@letuffe.org
qui suis-je : http://slyserv.dyndns.org



___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] Osm2pgsql and column names with two underscores

2009-03-30 Thread Cartinus
On Monday 30 March 2009 14:08:11 Jukka Rahkonen wrote:
 Look at these:
 openGeoDB:telephone_are a_code,
 openGeoDB:license_plate _code

 It looks like column name gets truncated at the second
 underline character. Could it be some bug in osm2pgsql,
 or is it some other place where the error occurs?

It doesn't get truncated at the second underscore as there is a character 
before the second underscore at the first case. Looks like it gets truncated 
after the 23th character.


-- 
m.v.g.,
Cartinus

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk