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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: [GENERAL] 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: [GENERAL] string_to_array with empty input
  • Date: Tue, 31 Mar 2009 12:11:19 -0400
  • Message-id: <49D240A7.1010009@emproshunts.com> <text/plain>

Sam Mason wrote:
I'd expect 3,2,1 and 1.

That's also a disingenuous example; what would you expect back from:

  select count_elements(string_to_array('butter,,milk',','))

I think the semantics you want is what you'd get from:

  array_filter_blanks(string_to_array($1,$2))

where I defined "array_filter_blanks" in my previous post.

I agree the function should not be changing values passed. Stripping/Dropping empty strings is changing what was passed into the function instead breaking it into a array.




Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group