0

I've got a problem with updating data for each row in the acrticles_pl_vector table using function in set clause and data take from another table.

For example I have a pseudocode:

CREATE OR REPLACE FUNCTION updateTsvector () 
RETURNS status AS
$$
BEGIN
    FOR EACH ROW otherTable
     UPDATE acrticles_pl_vector
     set vector = to_tsvector('polish', otherTable.title || otherTable.content);
     WHERE id = otherTable.id

END;
$$
LANGUAGE plpgsql

Thanks in advance!

0

1 Answer 1

1
CREATE OR REPLACE FUNCTION updateTsvector () RETURNS void AS $$
  UPDATE acrticles_pl_vector
    SET locale = 'pl', vector = to_tsvector('polish', ot.title || ot.content
    FROM otherTable ot
    WHERE id = ot.id;
$$ LANGUAGE sql;
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.