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

From Markus Bertheau
Subject Re: [SQL] array_in: '{}}'::text[]
Date
Msg-id 1093723759.2732.16.camel@teetnang
Whole thread Raw
In response to Re: [SQL] array_in: '{}}'::text[]  (Joe Conway <mail@joeconway.com>)
Responses Re: [SQL] array_in: '{}}'::text[]  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
В Сбт, 28.08.2004, в 21:33, Joe Conway пишет:

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

Without looking at the code in a whole, you accept '{} ' as an empty
array literal, so why is the special case for '{}' needed here? I should
be catched by the code that accepts additional whitespace after the last
closing brace, just that there is no white space:

> +     /* only whitespace is allowed after the closing brace */
> +     while (*ptr)
> +     {
> +         if (!isspace(*ptr++))
> +             ereport(ERROR,
> +                 (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
> +                 errmsg("malformed array literal: \"%s\"", str)));
> +     }
> +
> +     /* special case for an empty array */
> +     if (empty_array)
> +         return 0;

Here's the second special case for empty arrays.

--
Markus Bertheau <twanger@bluetwanger.de>


pgsql-patches by date:

Previous
From: Joe Conway
Date:
Subject: Re: [SQL] array_in: '{}}'::text[]
Next
From: Bruce Momjian
Date:
Subject: Re: Win32 fix: Token buffer