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

2004-08-28 Thread Joe Conway
Tom Lane wrote: actually, why isn't this just a pstrdup? Why not just if (strcmp(str, {}) == 0) Good points. Changes made, and attached committed. Joe Index: src/backend/utils/adt/arrayfuncs.c === RCS file:

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

2004-08-28 Thread Markus Bertheau
, 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

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

2004-08-28 Thread Joe Conway
Markus Bertheau wrote: Without looking at the code in a whole, you accept '{} ' as an empty array literal, so why is the special case for '{}' needed here? It's a fast path for a common special case. Why spend any cycles parsing if we can immediately recognize it? However, anything other than a

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

2004-08-27 Thread Joe Conway
Joe Conway wrote: Markus Bertheau wrote: Is there a reason the array_in parser accepts additional closing braces at the end? oocms=# SELECT '{}}'::text[]; text -- {} (1 ) Hmmm, I was *about* to say that this is fixed in cvs (and indeed, the array_in parser is significantly tightened up

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

2004-08-27 Thread Tom Lane
Joe Conway [EMAIL PROTECTED] 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?