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

320
Vistas
Inconsistent output format of Postgres query

I'm querying a Postgres database for 3 varchar(n) fields like follows:

Select ("Title","Author","Isbn") from public."Book" Where 1=1

The output of the query is a tuple with 3 strings. However the formatting of output is sometimes inconsistent between records. Note the output of the query:

enter image description here

Notice the difference in the first element between row 40 and row 41/42. The first element of row 40 is "Revolutionary Road" (wrapped in double quotes). The first element of row 41 is Neuromancer (not wrapped in quotes). The same phenomena occurs elsewhere in the query set as well.

I'm not sure why this first element is sometimes inconsistent in how it's returned by the query. It's not an issue with the individual records themselves. What else might be wrong?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The result is correct. In this output format, Postgres use quotes when string has spaces or some special chars:

postgres=# select row('ahoj', 'ahoj svete', 'ahoj,svete', '"ahoj svete"');
┌───────────────────────────────────────────────────┐
│                        row                        │
╞═══════════════════════════════════════════════════╡
│ (ahoj,"ahoj svete","ahoj,svete","""ahoj svete""") │
└───────────────────────────────────────────────────┘
(1 row)

If you don't want output format of composite value, don't use a row constructor:

postgres=# select 'ahoj', 'ahoj svete', 'ahoj,svete', '"ahoj svete"';
┌──────────┬────────────┬────────────┬──────────────┐
│ ?column? │  ?column?  │  ?column?  │   ?column?   │
╞══════════╪════════════╪════════════╪══════════════╡
│ ahoj     │ ahoj svete │ ahoj,svete │ "ahoj svete" │
└──────────┴────────────┴────────────┴──────────────┘
(1 row)
over 4 years ago · Santiago Trujillo Denunciar
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