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

212
Views
why postgres functions returns result in one column?

I have a simple PostgreSQL function which I aspect should return values into separate columns -115 and 101000005458E6258... but it returns one column where two values are separated by a comma -115,101000005458E6258.... What is wrong with my function?

CREATE OR REPLACE FUNCTION public.get_direction()
RETURNS TABLE(direction integer, geom geometry)             
AS $$
BEGIN
RETURN QUERY SELECT 
    heading-lag(heading) over (order by time) AS direction, a.geom AS geom 
    FROM public.mytable a 
    WHERE reg='125123' 
    GROUP BY heading, a.geom , a.time;
END; $$
LANGUAGE 'plpgsql';

I call the function

SELECT public.get_direction();

Thank you.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If you want the result as a set of columns, then you need:

SELECT * FROM public.get_direction();
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!