Create a gist now

Instantly share code, notes, and snippets.

@dlangille /query Secret
Created Jul 2, 2016

What would you like to do?
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.
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';
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