Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: array must have even number of elements #1

Closed
jlove73071 opened this issue Jan 14, 2020 · 3 comments · Fixed by #2
Closed

error: array must have even number of elements #1

jlove73071 opened this issue Jan 14, 2020 · 3 comments · Fixed by #2

Comments

@jlove73071
Copy link

ERROR: array must have even number of elements
Where: PL/pgSQL function _recursively_delete(regclass,text[],integer,jsonb,integer,text[],jsonb,jsonb) line 15 at assignment
SQL statement "SELECT * FROM _recursively_delete(ARG_table, VAR_pk_col_names)"
PL/pgSQL function recursively_delete(regclass,anyelement,boolean) line 73 at SQL statement

Any ideas?

@trlorenz
Copy link
Owner

Could you please show me how you called it? Is it not working for you at all, or just not for particular queries / table graphs?

Might have to go back and forth a little bit to arrive at a case I can reproduce on my side.

@trlorenz
Copy link
Owner

"I'm not sure this will help. but I just created your functions and then ran the following code: select recursively_delete('dallas.vendor',1094,false) After some debugging, I find that this dies right off the bat-- meaning, it seems like it's the first call to the function, not after doing multiple things. For reference I'm running PG 10.8"

Thanks, @jlove73071, that's something. How about this: Could you give me the schema of that table and its immediate dependents?

I've got a deadline to meet for something by Friday, but I'll screw around with it this weekend.

@trlorenz
Copy link
Owner

"ERROR: array must have even number of elements" seems to occur in the guts of PG where an attempt is made to coerce an array into an object.

Without a failing test case to work with, I'm just making guesses, but the info you've provided so far seems to suggest that, for you, for whatever reason...

VAR_ctab_pk_col_names := to_json(ARG_pk_col_names);

...to_json is trying to coerce to an object what is explicitly an array.

In any case, I got rid of all use of to_jsonb in favor of more explicit conversion. (to_json in the code example above was a typo, BTW; it was meant to have been to_jsonb. But that shouldn't really have an effect on anything.)

@jlove73071, please give branch...

trl-fix-array_must_have_even_number_of_elements

...a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants