Skip to main content
11 events
when toggle format what by license comment
Sep 1, 2017 at 17:24 comment added Evan Carroll SQL is a declarative language that has a declarative method that takes a query and generates an on disk cache of that query. You don't need to write a function that accepts an array, or accepts a text query, you just need CREATE MATERIALIZED VIEW that's sql-esque. That's the SQL way to do it.
Sep 1, 2017 at 17:23 comment added Randomize btw what do you mean for making it more sql-esh? What I am trying to do it is making more reusable the code. SQL (for my limited knowledge of it) is usually less flexible than general purpose languages so I end up to look for workaround like that.
Sep 1, 2017 at 16:40 vote accept Randomize
Sep 1, 2017 at 16:22 comment added Evan Carroll Just FYI @Randomize, A SQL array is a container type. It's not meant to hold a result set. And doing that is going to sting no way around it -- it's going to be worse in every way (slower, memory intensive, less terse, etc)
Sep 1, 2017 at 16:19 comment added Evan Carroll So if you insist, just pass the query as text to generate the materialized view in the sql function... Or just remove that silly wrapper and changer your work flow a little bit to be more sql-esque.
Sep 1, 2017 at 16:18 comment added Randomize Yes, what I need right now is just being able to reuse code passing a specific type of data independently from the source. All the checks will come after.
Sep 1, 2017 at 16:15 comment added Evan Carroll So what good is it?. You have a function that generates a table if it doesn't exist and the rest of your code base assumes that it all went as planned and queries it based on the hard-coded table name?
Sep 1, 2017 at 16:14 comment added Randomize it is not doing it at the moment
Sep 1, 2017 at 16:09 comment added Evan Carroll @Randomize how did your function my_func return the table name of the table it generated?
Sep 1, 2017 at 16:06 comment added Randomize The problem is that I am workaround different kind of inputs. Please read my updated question.
Sep 1, 2017 at 15:59 history answered Evan Carroll CC BY-SA 3.0