Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda