Reputation: 36746
If I execute the following command alone in PostgreSQL, it will insert the result of the query in a table called token_relation
, but if I put this inside a PL/PGSQL function, it will try to put inside a RECORD variable.
SELECT *
INTO token_relation
FROM textblockhastoken
ORDER BY textblockid, sentence, position
LIMIT 500;
I want to insert in another table like when the command is execute alone. How I do this inside the function?
Upvotes: 0
Views: 1878
Reputation: 9170
Perhaps you want:
INSERT INTO token_relation
SELECT *
FROM textblockhastoken
ORDER BY textblockid, sentence, position
LIMIT 500;
Upvotes: 4