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
-
I don't believe that text "path" is supposed to be included in VALUES postgresql.org/docs/9.4/datatype-geometric.html.user30184– user301842020年02月05日 09:29:02 +00:00Commented Feb 5, 2020 at 9:29
-
Removed it and the message remains the same!chatzich– chatzich2020年02月05日 09:31:08 +00:00Commented Feb 5, 2020 at 9:31
1 Answer 1
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
-
Strange but it works! thank you! Post your answer also at stackoverflow.com/questions/60072610/…chatzich– chatzich2020年02月05日 09:38:16 +00:00Commented Feb 5, 2020 at 9:38
-
@chatzich: answer yourself for stackoverflow, link it the answer here if you want.J. Monticolo– J. Monticolo2020年02月05日 09:41:40 +00:00Commented Feb 5, 2020 at 9:41
-
I have done it alreadychatzich– chatzich2020年02月05日 09:42:33 +00:00Commented Feb 5, 2020 at 9:42
-
More examples about the right syntax for PostgeSQL native geometry types in postgresql.org/docs/12/functions-geometry.htmluser30184– user301842020年02月05日 10:33:11 +00:00Commented Feb 5, 2020 at 10:33
lang-sql