Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Document special array constructor for PostgreSQL #404

Closed
seancorfield opened this issue Apr 6, 2022 · 1 comment
Closed

Document special array constructor for PostgreSQL #404

seancorfield opened this issue Apr 6, 2022 · 1 comment
Assignees
Labels
documentation I need to write something up!

Comments

@seancorfield
Copy link
Owner

See https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS

Add something to PG Tips & Tricks!

"It is also possible to construct an array from the results of a subquery. In this form, the array constructor is written with the key word ARRAY followed by a parenthesized (not bracketed) subquery. For example:"

SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');

You can create this syntax with [:'ARRAY {:select ..}]

@seancorfield seancorfield added the documentation I need to write something up! label Apr 6, 2022
@seancorfield seancorfield self-assigned this Apr 6, 2022
@seancorfield
Copy link
Owner Author

dev=> (sql/format {:select [[[:'ARRAY {:select :oid :from :pg_proc :where [:like :proname [:inline "bytea%"]]}]]]})
["SELECT ARRAY (SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%')"]

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation I need to write something up!
Projects
None yet
Development

No branches or pull requests

1 participant