1

I have created a table with a column type PATH as above (following the PostgreSQL documentation)

CREATE TABLE public.geometry_polyline_volume
(
 id serial not null primary key,
 distance float not null,
 height float not null,
 coordinates path not null
);

Trying to insert the above values as a row

INSERT INTO public.geometry_polyline_volume(id, distance, height, coordinates)
VALUES (2, 500, 0, path((15.878137629895164,47.08306448089695), (15.56169808311181,47.219041634920686), (15.267442604782124,47.4201665137259), (15.092631384557304,47.71366328136526), (15.234428926980286,47.95865145177352)));

I am taking the following error

Message : ERROR: column "coordinates" is of type path but expression is of type record

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Feb 5, 2020 at 9:21
2
  • I don't believe that text "path" is supposed to be included in VALUES postgresql.org/docs/9.4/datatype-geometric.html. Commented Feb 5, 2020 at 9:29
  • Removed it and the message remains the same! Commented Feb 5, 2020 at 9:31

1 Answer 1

2

Try to convert it into text, like the following :

INSERT INTO public.geometry_polyline_volume(id, distance, height, coordinates)
VALUES (
 2,
 500,
 0,
 path(
 '(15.878137629895164,47.08306448089695),
 (15.56169808311181,47.219041634920686),
 (15.267442604782124,47.4201665137259),
 (15.092631384557304,47.71366328136526),
 (15.234428926980286,47.95865145177352)'
 )
);
answered Feb 5, 2020 at 9:34
4
  • Strange but it works! thank you! Post your answer also at stackoverflow.com/questions/60072610/… Commented Feb 5, 2020 at 9:38
  • @chatzich: answer yourself for stackoverflow, link it the answer here if you want. Commented Feb 5, 2020 at 9:41
  • I have done it already Commented Feb 5, 2020 at 9:42
  • More examples about the right syntax for PostgeSQL native geometry types in postgresql.org/docs/12/functions-geometry.html Commented Feb 5, 2020 at 10:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.