Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
pg query in javascript not recognizing postgis geomtype POINT

I'm having problems running a query that works directly in psql with postgis extension but not with the javascrip pg library connection within a prepared statement.

The query that runs and writes in the database is as follows:

INSERT INTO waps(bssid, strength, "location")
VALUES('T_601', '100', ST_GeomFromText('POINT(38.70722651513132, -9.15248591105515)', 4326));

The table waps has the location column as geometry type.

In my college javascript project I have this section of code returning an error:

        let sql = "INSERT INTO waps (bssid, strength, location) VALUES($1,$2, ST_GeomFromText(POINT($3),4326)) RETURNING id";
        let wapId = await pool.query(sql, [bssid, strenght, location]);

location receives ex: "38.70722651513132, -9.15248591105515", and returns an error:

{ error: function point(unknown) is not uniqueupLog Completed in 2ms
    at Parser.parseErrorMessage (project/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (project/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (project/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.stream.on (project/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  length: 195,
  name: 'error',
  severity: 'ERROR',
  code: '42725',
  detail: undefined,
casts.',
  position: '76',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_func.c',
  line: '572',
  routine: 'ParseFuncOrColumn' }

So why does the query in psql runs normally but when prepared in a javascript environment throws an error?

The problem lies, normally, between the screen and the chair, so any help is appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!