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 on insert from table #32

Open
ziva777 opened this issue Nov 27, 2020 · 0 comments
Open

Error on insert from table #32

ziva777 opened this issue Nov 27, 2020 · 0 comments

Comments

@ziva777
Copy link
Contributor

ziva777 commented Nov 27, 2020

It's possible to insert into variable record from table even if amount of fields in the row are different. But there is an error on select variable after insert from a table with "different row type".

Consider next queries:

CREATE TABLE tab (id int, t varchar);
INSERT INTO tab VALUES (0, 'str00');

SELECT pgv_insert('vars', 'r1', row(1, 'str1', 'str2'));
SELECT pgv_insert('vars', 'r0', tab) FROM tab;
SELECT pgv_insert('vars', 'r1', tab) FROM tab;

SELECT pgv_select('vars', 'r1');

The last one statement of pgv_select bring an error like:

   pgv_select    
-----------------
 (1,str1,str2)
 (0,"\rstr00~",)
(2 rows)

The output may differs, but apparently there is a problem with memory access here.

A more general question is it should be possible to insert record with different amount of fields in the existing variable? Probably not, since behavior becomes too implicit.

ziva777 pushed a commit that referenced this issue Dec 8, 2020
ziva777 pushed a commit that referenced this issue Dec 9, 2020
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

No branches or pull requests

1 participant