Skip to content

Instantly share code, notes, and snippets.

@mvodep
Last active August 19, 2021 18:06
Show Gist options
  • Save mvodep/909cc643f09bbf018c131904cb8f8435 to your computer and use it in GitHub Desktop.
Save mvodep/909cc643f09bbf018c131904cb8f8435 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE FUNCTION some_function(some_ids UUID[])
RETURNS TABLE (id INTEGER)
LANGUAGE SQL
AS $$
-- ERROR: function some_function(record[]) does not exist
CREATE OR REPLACE FUNCTION some_function(VARIADIC some_ids UUID[])
RETURNS TABLE (id INTEGER)
LANGUAGE SQL
AS $$
// Doesnt work:
@Query(nativeQuery = true, value = "SELECT some_function(ARRAY[:uuids])")
LinkedHashSet<Integer> getSomeFunction(Collection<UUID> uuids);
// Works with VARIADIC
@Query(nativeQuery = true, value = "SELECT some_function(:uuids)")
LinkedHashSet<Integer> getSomeFunction(Collection<UUID> uuids);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment