[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ViewTableMacro and empty parameteters

It’s a need idea, and it could easily be done by a table macro. I just wouldn’t call it a “view” anymore, because SQL views do not take parameters, and as you can see, the syntax to call is now table function syntax rather than view syntax.

I like the idea of parameterized views. For instance a “view” that takes not only literals as parameters but also relational expressions and expressions (e.g. boolean expressions). I just never found a good syntax for it, other than table function syntax.

If you’re familiar with Lisp you will know why I called them table macros. So maybe we need a SQL equivalent of quasi-quote?! [1]


[1] https://courses.cs.washington.edu/courses/cse341/04wi/lectures/14-scheme-quote.html <https://courses.cs.washington.edu/courses/cse341/04wi/lectures/14-scheme-quote.html> 

> On Oct 22, 2018, at 5:24 AM, ptr.bojko@xxxxxxxxx wrote:
> Hello dear Calcite team :)
> I have one design question on ViewTableMacro:
> Why does it not implement parameters?
> I was thinking about dynamic parameters "?" here. For example, following
> view with dynamic parameters
> some_view: SELECT * FROM some_table WHERE id > ? AND LIMIT ?
> could handle two parameters and then this view could be used as follows:
> SELECT * FROM TABLE(some_view(2,100))
> Regards!
> -- 
> Piotr Bojko
> http://about.me/ptr.bojko