Tom Lane wrote: > mlw <[EMAIL PROTECTED]> writes: > > Would it be possible to allocate varibles that can be addressed with SET? > > And what would you do with them? > > There is a simple variable facility in psql these days, if that helps.g I was thinking more like: create variable fubar ; set fubar = select max(column) from table; select * from table where column = :fubar; Obviously this is a very simple example. I guess I am asking for something analogous to temporary tables, but on a single datum level. I like the way psql does it, but it would be better to have this available in the native query language. This is similar to a feature which Oracle has. It is mainly to avoid hitting the query planner. Oracle caches query execution instructions, and using a variable is a way to reuse cached queries with different data. Being able to set variables and use them in queries may help some people port from Oracle to Postgres. BTW I am also working on the impression that a view is more efficient than reissuing a complex query. Or is there no difference? > > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
