Re: array_in sub function ReadArrayDimensions error message

2024-07-09 Thread David G. Johnston
On Tuesday, July 9, 2024, jian he wrote: > > I also found other issues, like. > select '[-2:2147483644]={3}'::int[]; > ERROR: malformed array literal: "[-2:2147483644]={3}" > LINE 1: select '[-2:2147483644]={3}'::int[]; >^ > DETAIL: Specified array dimensions do not match array

Re: array_in sub function ReadArrayDimensions error message

2024-07-09 Thread jian he
On Tue, Jul 9, 2024 at 11:31 PM Tom Lane wrote: > > jian he writes: > > On Mon, Jul 8, 2024 at 10:42 PM Tom Lane wrote: > >> One possibility could be > >> ... > >> that is, only say "Missing "]"" if there's no ']' anywhere, and > >> otherwise just say the dimensions are wrong. This could be foo

Re: array_in sub function ReadArrayDimensions error message

2024-07-09 Thread David G. Johnston
On Tue, Jul 9, 2024 at 8:59 AM Tom Lane wrote: > "David G. Johnston" writes: > > > I'd add a hint if the first symbol is [ and we fail to get to the point > of > > actually seeing the equal sign or the first subsequent unquoted symbol > is a > > comma instead of a colon. > > That seems closely r

Re: array_in sub function ReadArrayDimensions error message

2024-07-09 Thread Tom Lane
"David G. Johnston" writes: > One possibility all this ignores is that what we are calling > array-dimensions are in reality most likely a user using json array syntax > in our SQL arrays. That seems eminently more likely than someone > mis-typing this niche incantation of building an array liter

Re: array_in sub function ReadArrayDimensions error message

2024-07-09 Thread David G. Johnston
On Tue, Jul 9, 2024 at 8:31 AM Tom Lane wrote: > > Here again, the problem is not a missing "=", it's invalid > syntax somewhere before that. > > Another thing we could consider doing here (and similarly > for your original case) is > > DETAIL: Expected "=" not "," after array dimensions. > > Th

Re: array_in sub function ReadArrayDimensions error message

2024-07-09 Thread Tom Lane
jian he writes: > On Mon, Jul 8, 2024 at 10:42 PM Tom Lane wrote: >> One possibility could be >> ... >> that is, only say "Missing "]"" if there's no ']' anywhere, and >> otherwise just say the dimensions are wrong. This could be fooled >> by a ']' that's part of some string in the data, but eve

Re: array_in sub function ReadArrayDimensions error message

2024-07-08 Thread jian he
On Mon, Jul 8, 2024 at 10:42 PM Tom Lane wrote: > > jian he writes: > > while reviewing the json query doc, > > I found out the following error message was not quite right. > > > select '[1,2]'::int[]; > > ERROR: malformed array literal: "[1,2]" > > LINE 1: select '[1,2]'::int[]; > >

Re: array_in sub function ReadArrayDimensions error message

2024-07-08 Thread Tom Lane
jian he writes: > while reviewing the json query doc, > I found out the following error message was not quite right. > select '[1,2]'::int[]; > ERROR: malformed array literal: "[1,2]" > LINE 1: select '[1,2]'::int[]; >^ > DETAIL: Missing "]" after array dimensions. > should it

array_in sub function ReadArrayDimensions error message

2024-07-08 Thread jian he
while reviewing the json query doc, I found out the following error message was not quite right. select '[1,2]'::int[]; ERROR: malformed array literal: "[1,2]" LINE 1: select '[1,2]'::int[]; ^ DETAIL: Missing "]" after array dimensions. should it be: "Missing delimiter ":" while s