-
-
Save dlangille/3f464ac2537028f0602551f1bf4db2ba to your computer and use it in GitHub Desktop.
I have this query in a plpgsql function, and I want to discard the result set, and I think I need to do that via PERFORM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RECURSIVE all_descendents AS ( | |
SELECT id, name, parent_id, directory_file_flag, status | |
FROM element | |
WHERE id = (select pathname_id('/ports/head/' || a_category_name || '/' || a_port_name || '/')) | |
UNION | |
SELECT E.id, E.name, E.parent_id, E.directory_file_flag, E.status | |
FROM element E | |
JOIN all_descendents AD | |
ON (E.parent_id = AD.id) | |
) | |
SELECT element_add(replace(element_pathname(id), '/ports/head/', '/ports/branches/' || a_branch_name || '/'), directory_file_flag), | |
replace(element_pathname(id), '/ports/head/', '/ports/branches/' || a_branch_name || '/'), directory_file_flag | |
FROM all_descendents | |
WHERE status = 'A'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PERFORM | |
WITH RECURSIVE all_descendents AS ( | |
SELECT id, name, parent_id, directory_file_flag, status | |
FROM element | |
WHERE id = (select pathname_id('/ports/head/' || a_category_name || '/' || a_port_name || '/')) | |
UNION | |
SELECT E.id, E.name, E.parent_id, E.directory_file_flag, E.status | |
FROM element E | |
JOIN all_descendents AD | |
ON (E.parent_id = AD.id) | |
) | |
SELECT element_add(replace(element_pathname(id), '/ports/head/', '/ports/branches/' || a_branch_name || '/'), directory_file_flag), | |
replace(element_pathname(id), '/ports/head/', '/ports/branches/' || a_branch_name || '/'), directory_file_flag | |
FROM all_descendents | |
WHERE status = 'A'; | |
ERROR: syntax error at or near "PERFORM" | |
LINE 1: PERFORM | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment