Re: [SQL] array_in: '{}}'::text[] - Mailing list pgsql-patches

From Tom Lane
Subject Re: [SQL] array_in: '{}}'::text[]
Date
Msg-id 14978.1093662341@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] array_in: '{}}'::text[]  (Joe Conway <mail@joeconway.com>)
Responses Re: [SQL] array_in: '{}}'::text[]
List pgsql-patches
Joe Conway <mail@joeconway.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

pgsql-patches by date:

Previous
From: "Ed L."
Date:
Subject: Re: log_filename_prefix --> log_filename + strftime()
Next
From: Andreas Pflug
Date:
Subject: Re: log_filename_prefix --> log_filename + strftime()