1

I cannot find an example of how it's supposed to work for a table with only one PK field.

My attempt looks something like this:

CREATE EXTENSION IF NOT EXISTS dblink;

select dblink_build_sql_insert('table_name'::text, '1'::int2vector, 1::int2, '{"12345"}'::text[], '{"column1", "column2", "column3", "column4"}'::text[]);

It keeps trowing the error "target key array length must match number of key attributes". As I see it I told him that the number of key attributes is 1 and the target key array length has 1 item. What am I doing wrong?

1 Answer 1

1

If I read the examples right, I think you need to do something like

select dblink_build_sql_insert(
     'table_name'::text, 
     '1'::int2vector, 
      1::int2,  -- num of pkey values
      '{"12345"}'::text[], -- old pkey 
     '{"column1"}'::text[] -- new pkey
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.