Unable to insert geometry Postgres
Hey everyone ๐๐ป
Greetings!
I am trying to insert
point
data into my Postgresql table but getting error: parse error - invalid geometry
error. Here is the code
and here is the schema:
and here is my database schema:
i tried solution provided by @koskimas in the https://github.com/kysely-org/kysely/issues/133#issuecomment-1209233409 but no luck.
attaching the log generated by kysely
Query: insert into "location" ("name", "coordinates") values ($1, $2) returning * [91.9 ms]
$1: Anom
$2: (-71.060316,48.432044)
Unable to figure out whats wrong. Thanks.GitHub
Postgres point type support for insert queries ยท Issue #133 ยท kysel...
I am using kysely with the PostgresDialect configuration as const db = new Kysely<Database>({ dialect: new PostgresDialect({ pool, }), plugins: [new CamelCasePlugin()], }); I am also using po...
4 Replies
Does this work
or this
I'm just googling stuff here
Hey @koskimas , thanks for the reply.
Both solutions are working as expected and i am able to insert point :).
i am using following code to retrieve stored coordinates from the database
Above code is working as exepected but, i was wondering is there any other better approach for the above query?
I don't know if this is better but you could do this
https://kyse.link/?p=s&i=Jezrbtdk2cOJeCymdl3b
I didn't run the code so there might be some bugs
But you get the gist. You can create helpers for everything to clean up the code and make it (relatively) type-safe
Thanks @koskimas , it is more typesafe now.
I really appreciate your time and efforts to build this wonderful library. ๐