Reputation: 1
I am running this command:
INSERT INTO groupmembers (memberid, groupid)
VALUES(60, SELECT get_groupid());
and I get this:
ERROR: syntax error at or near "SELECT"
Running
SELECT get_groupid();
gives the following:
get_groupid
-----------
61
(1 row)
I am trying to get get the value 61 but instead getting the row with that. How do I get the value inside that row instead?
This is what get_groupid looks like
CREATE FUNCTION get_groupdid() RETURNS int
AS $$
DECLARE
groupid int;
BEGIN
SELECT groups.id INTO STRICT groupid
FROM groups WHERE name = 'Tier 1';
RETURN groupid;
END
$$ LANGUAGE plpgsql;
Upvotes: 0
Views: 45