Re: [SQL] array_in: '{}}'::text[]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Markus Bertheau <twanger(at)bluetwanger(dot)de>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [SQL] array_in: '{}}'::text[]
Date: 2004-08-28 03:05:41
Message-ID: 14978.1093662341@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches pgsql-sql

Joe Conway <mail(at)joeconway(dot)com> writes:
> /* Make a modifiable copy of the input */
> ! string_save = (char *) palloc0(strlen(string) + 1);
> strcpy(string_save, string);

palloc0, instead of palloc, is clearly a waste of cycles here ...

actually, why isn't this just a pstrdup?

> /* special case for an empty array */
> ! if (strlen(str) == 2 && strncmp(str, "{}", 2) == 0)
> return 0;

Why not just if (strcmp(str, "{}") == 0)

Looks reasonable otherwise.

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message pgsql 2004-08-28 04:00:58 Re: Contrib -- PostgreSQL shared variables
Previous Message Ed L. 2004-08-27 23:20:56 Re: log_filename_prefix --> log_filename + strftime()

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Stark 2004-08-28 08:35:58 Re: Aggregate query for multiple records
Previous Message Gaetano Mendola 2004-08-28 02:16:45 Re: backup of a specific schema