If you are interested in performance things, you may use the EXPLAIN
command:
explain select * from "GetLanguages"() where "Id" > 44
vs.
explain select * from "Languages" where "Id">44;
However the explain stops at the point a function is invoked.
This may mean that (as you asked) a select ove
Hello,
How do you encrypt() & decrypt() data of types INT4 or DATE?
The PGCrypto methods encrypt() and decrypt() each take BYTEA as input:
i.e.,
encrypt( data::bytea, key::bytea, type::text)
decrypt( data::bytea, key::bytea, type::text)
So how do you convert INT4 and DATE data into BYTE
"Tambet Matiisen" <[EMAIL PROTECTED]> writes:
> It seems that subquery scan is only used, when the query can not be
> translated into single flat query. Which is mostly good, I assume.
The planner thinks so anyway ;-)
If you're desperate you can put in an optimization fence, for instance
LIMIT or
>
> "Tambet Matiisen" <[EMAIL PROTECTED]> writes:
> > How tough it would be to implement
>
> > CREATE VIEW xxx PARAMETERS (yyy) AS zzz;
>
> > as
>
> > CREATE TYPE xxx;
> > CREATE FUNCTION xxx(yyy) RETURNING SETOF xxx LANGUAGE sql AS 'zzz';
>
> What's the point? It'd be nonstandard anyway,
...
>
> Does this do better:
>
> SELECT
> prodid,
> avg(prodcost) as average_cost,
> sum(prodcost * salesamount) as cost_total
> FROM (
> SELECT
> p.product_id as prodid,
> product_cost(s.product_id, s.date) as prodcost,
> s.amount as salesamount
> FROM products p
> LEFT
Look in the plpgsql docs on EXECUTE.
But for something that simple, why don't you just generate a query ?
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail comm
Oh sorry.
I was not clearly.
I've wanted to create a function that suport to select a "parameter variable"
table. Like: return 'select * from $1'.
The Postgresql does not suport this sql function becouse the $1 variable is
considerate as a table... the Postgresql return an error like: The table "$