In response to silly sad :
> hello.
>
> Postgresql 8.3.9
>
> CREATE TYPE usr_secrets AS (login TEXT, pass TEXT, shop_pass TEXT);
>
> CREATE OR REPLACE FUNCTION get_noobs () RETURNS SETOF usr_secrets AS $$
> BEGIN
> RETURN QUERY SELECT login, '*' as pass, shop_pass FROM noob;
> RETURN;
> END;
hello.
Postgresql 8.3.9
CREATE TYPE usr_secrets AS (login TEXT, pass TEXT, shop_pass TEXT);
CREATE OR REPLACE FUNCTION get_noobs () RETURNS SETOF usr_secrets AS $$
BEGIN
RETURN QUERY SELECT login, '*' as pass, shop_pass FROM noob;
RETURN;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
SELECT *
Aron writes:
> I would like to avoid using "SELECT MAX(id) FROM my_table" (it doesn't seem a
> good method), but if I use "new.id", I get new id values, not the "id"
> inserted with the rule, and the condition is always false.
"new.id" is a macro, which in this example will be expanded into a
n
I would like to avoid using "SELECT MAX(id) FROM my_table" (it doesn't seem a
good method), but if I use "new.id", I get new id values, not the "id"
inserted with the rule, and the condition is always false.
Complete example (it works because it doesn't use new.id inside condition):
DROP TABLE