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

317
Views
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 answers
Answer question

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 Report
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!