Re: proposal - function string_to_table

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-04-18T03:45:22Z
Lists: pgsql-hackers

Attachments

pá 17. 4. 2020 v 23:29 odesílatel Justin Pryzby <pryzby@telsasoft.com>
napsal:

> On Fri, Apr 17, 2020 at 07:47:15PM +0200, Pavel Stehule wrote:
> > I propose new function string_to_table. This function is significantly
>
> +1
>
> > +/*
> > + * Add text to result set (table or array). Build a table when set is a
> expected or build
> > + * a array
>
> as expected (??)
> *an* array
>

I tried to fix this comment


>
> > +select string_to_table('abc', '', 'abc');
> > + string_to_table
> > +-----------------
> > +
> > +(1 row)
>
> Maybe you should \pset null '(null)' for this
>

changing NULL output can break lot of existing tests, but I add second
column with info about null

+select string_to_table('1,2,3,4,*,6', ',', '*'),
string_to_table('1,2,3,4,*,6', ',', '*') IS NULL;
+ string_to_table | ?column?
+-----------------+----------
+ 1               | f
+ 2               | f
+ 3               | f
+ 4               | f
+                 | t
+ 6               | f
+(6 rows)

Regards

Pavel


> --
> Justin
>

Commits

  1. Add string_to_table() function.