[Tile-serving] [openstreetmap/osm2pgsql] Error uploading node tags with flex: Invalid type 'table' for text column. (Issue #1677)

Filippo Contro notifications at github.com
Wed May 25 12:38:17 UTC 2022


## What version of osm2pgsql are you using?

2022-05-25 12:26:54  osm2pgsql version 1.4.1
Compiled using the following library versions:
Libosmium 2.16.0
Proj [API 4] Rel. 7.2.1, January 1st, 2021
Lua 5.3.3

## What operating system and PostgreSQL/PostGIS version are you using?

Official PostGIS Docker image 

## Tell us something about your system

16 GB RAM, i7 8th gen, Dell 7400

## What did you do exactly?

I want to import only node, ways and their relations on DB, with a simple structure. I grab the basic flex example and modified it to my needs. These are the essential parts.

```lua
local tables = {}
local projection = 'WGS84'

tables.nodes = osm2pgsql.define_node_table('node', {
    { column = 'tags', type = 'jsonb' },
    { column = 'geom', type = 'point', projection = projection },
})

tables.ways = osm2pgsql.define_way_table('way', {
    { column = 'tags', type = 'jsonb' },
    { column = 'oneway', type = 'boolean' },
    { column = 'geom', type = 'linestring', projection = projection },
})

tables.nodeWays = osm2pgsql.define_table({
    name = 'nodeWay',
    ids = { type = 'way', id_column = 'wayId' },
    columns = {
        { column = 'nodeId', type = 'int' },
        { column = 'nodeIndex', type = 'int' }
    }
})

function osm2pgsql.process_node(object)
    if clean_tags(object.tags) then
        return
    end

    tables.nodes:add_row({
        tags = object.tags,
    })
end
```

Then I launch `osm2pgsql -c /home/nord-est-latest.osm.pbf -d osm -O flex -S /home/flex.lua -s` with the nord-est file taken from Geofabrik on north east of Italy.

## What did you expect to happen?

Upload all nodes with id, tag and location.

## What did happen instead?

```
ERROR: Failed to execute Lua function 'osm2pgsql.process_node': /home/flex.lua:365: Error in 'add_row': Invalid type 'table' for text column.

stack traceback:
        [C]: in method 'add_row'
        /home/flex.lua:365: in function </home/flex.lua:358>.
```

## What did you do to try analyzing the problem?

If I do the processing without the tags in the `add_row` function, the nodes are loaded with the tags column filled with `NULL` values.
Instead, if I do the processing with the nodes stringified (i used [this](https://gist.github.com/tylerneylon/59f4bcf316be525b30ab)) they are loaded as expected.

The same happens even if I use the provided example `simple.lua`.

The table structure will probably change for my needs, but the interesting part for me is the node upload error.

I don't know if this is a bug or if I did a mistake, but I did not found similar issues, so I hope this to be helpful to someone.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1677
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/issues/1677 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220525/2f4a8519/attachment.htm>


More information about the Tile-serving mailing list