Re: Order of rows in simple "select r from table_fn()"

2023-02-14 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > >> b...@yugabyte.com wrote: >> >> I've found that a table function with "returns table(r text)" provides a >> convenient way to write a nicely formatted report using psql that can be >> easily directed to a file with the "\o" metacommand. In general, for ca

Re: Order of rows in simple "select r from table_fn()"

2023-02-14 Thread Pavel Stehule
Hi > It adds an uncomfortable amount of clutter. > > ** Is it essential for correctness? ** > > It's annoying that the use of "return next" prevents the pattern that each > "print line" follows from being encapsulated into a procedure. But it is > what it is, yes? > RETURN NEXT, RETURN QUERY (RE

Re: Order of rows in simple "select r from table_fn()"

2023-02-14 Thread David G. Johnston
On Tue, Feb 14, 2023 at 4:49 PM Bryn Llewellyn wrote: > I've found that a table function with "returns table(r text)" provides a > convenient way to write a nicely formatted report using psql that can be > easily directed to a file with the "\o" metacommand. In general, for cases > like this, I c

Order of rows in simple "select r from table_fn()"

2023-02-14 Thread Bryn Llewellyn
In general, the order of the rows in a result set is stated to be unpredictable without an "order by" at the outermost level. Famously, beginners observe what seems to be reliably reproducible ordering in some queries that don't have an "order by"—and it can take some effort to persuade them tha