OSM2PGSQL import timestamp from osm PBF file using flex output

Hi, I am new to osm2pgsql and i am figuring out how to import timestamp from osm .pbf file using the flex output. I am using version 1.8.0

My problem: Can’t access to object.timestamp as the documentation says

My Lua file:

local pois = osm2pgsql.define_table({
    name = 'pois',
    ids = { type = 'any', type_column = 'osm_type', id_column = 'osm_id' },
    columns = {
        { column = 'updated_at'},
        { column = 'name' },
        { column = 'class', not_null = true },
        { column = 'subclass' },
        { column = 'geom', type = 'point', not_null = true },
        { column = 'tags', type = 'jsonb' },
}})


function process_poi(object, geom)
    local a = {
        updated_at = object.timestamp or nil,
        name = object.tags.name,
        geom = geom,
        tags = object.tags,
    }

    if object.tags.amenity and ( 
           object.tags.amenity == 'place_of_worship' or 
           object.tags.amenity == 'drinking_water' 
        )
        then
        a.class = 'amenity'
        a.subclass = object.tags.amenity
    elseif object.tags.natural and (
           object.tags.natural == 'peak' or
           object.tags.natural == 'spring'
        )
        then
        a.class = 'natural'
        a.subclass = object.tags.natural   
    else
        return
    end

    pois:insert(a)
end

function osm2pgsql.process_node(object)
    process_poi(object, object:as_point())
end

function osm2pgsql.process_way(object)
    if object.is_closed and object.tags.building then
        process_poi(object, object:as_polygon():centroid())
    end
end

What am i missing here?

Thank you for the attention.

You need to run osm2pgsql with the -x option to get access to the meta attributes like timestamp. Note the little (*) footnote next to some of the attributes in the documentation.

That’s exactly what i was missing, thank you for the fast answer.