[Tile-serving] [osm2pgsql-dev/osm2pgsql] How to get node id list into column (Discussion #2216)

iboates notifications at github.com
Sun Jul 28 10:21:27 UTC 2024


How can I write the `object.nodes` into a table column?

I have it defined like this:

```
local edges = osm2pgsql.define_table({
    name = 'edges_pre',
    ids = { type = 'any', id_column = 'osm_id' },
    columns = {
        { column = 'node_ids', sql_type = 'integer array' },
        { column = 'geom', type = 'linestring', projection = 4326, not_null = true },
    }
})

function osm2pgsql.process_way(object) {

    edges:insert({
        node_ids = object.nodes,
        geom = object:as_linestring()
    })

}

```

But I get:

```
2024-07-28 10:17:51  ERROR: Failed to execute Lua function 'osm2pgsql.process_way': /mnt/style/osm2pgr_default.lua:168: Error in 'insert': Invalid type 'table' for text column.

stack traceback:
        [C]: in function 'insert'
        /mnt/style/osm2pgr_default.lua:168: in function </mnt/style/osm2pgr_default.lua:150>.
```

Do I need to apply some kind of conversion?

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

Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2216 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240728/d528afc8/attachment.htm>


More information about the Tile-serving mailing list