I have a view that basis on the table 'mytable' with these columns:

enter image description here

The view created as

CREATE or REPLACE VIEW viewbox.myview AS
SELECT mytable.h AS height,
FROM mytable;

with columns

enter image description here

When trying to export to shp -> sql

shp2pgsql -s 3857 -I -g geometry /data/relief_poly.shp relief_poly > /data/relief_poly.sql

I get

enter image description here

and in SQL column "height" is float8!

I am not really plugged in to the case why my column datatype changed.

1 Answer 1


Due to the answer, qlonglong is integer64 in QGIS, because length is more than 9. So, to get integer type not qlonglong (integer64), the length should be from 1 to 9. I recreated table column with SMALLINT type and rewrote my view -> in SQL column height is integer!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.