Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] string_to_array with empty input

From: justin <justin(at)emproshunts(dot)com>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] string_to_array with empty input
Date: 2009-03-31 16:48:54
Message-ID: 49D24976.5040300@emproshunts.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Sam Mason wrote:
>
>   string_to_array('',',')::INT[]  => invalid input syntax for integer: ""
>
> Which you don't get at the moment; although you do currently get it in
> other common cases such as:
>
>   string_to_array('1,',',')::INT[]
>
> If you want backwards compatible behaviour you could always bung a
> NULLIF in there:
>
>   string_to_array(NULLIF('',''),',')::INT[]  => NULL
>
>
>   

But consider  this fails also

select string_to_array('1, , 3', ',' )::int[] => ERROR:  invalid input 
syntax for integer: " "

yet this works

select string_to_array('1, 2, 3',',')::int[]

In response to

Responses

pgsql-hackers by date

Next:From: Euler Taveira de OliveiraDate: 2009-03-31 16:55:02
Subject: Re: can't load plpython
Previous:From: Emmanuel CecchetDate: 2009-03-31 16:45:17
Subject: Re: Partitioning feature ...

pgsql-general by date

Next:From: Greg StarkDate: 2009-03-31 17:06:03
Subject: Re: string_to_array with empty input
Previous:From: Harald FuchsDate: 2009-03-31 16:41:42
Subject: Re: [GENEAL] dynamically changing table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group