Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error on insert from table #32

Closed
Closed
@ziva777

Description

@ziva777

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions