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

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

В Сбт, 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(at)bluetwanger(dot)de>

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-08-28 21:00:36 Re: Win32 fix: Token buffer
Previous Message Andreas Pflug 2004-08-28 19:50:44 Re: log_filename_prefix --> log_filename + strftime()

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2004-08-28 22:41:27 Re: [SQL] array_in: '{}}'::text[]
Previous Message Joe Conway 2004-08-28 19:33:35 Re: [SQL] array_in: '{}}'::text[]