Thread: stored queries

stored queries

From
Joop
Date:
Hello everyone,

I'm just about to start on the reporting part of a PostgreSQL / PHP
application. I think it would be a good idea to create a table in my db in
which I can store queries, something like this:

create table stored_queries ( id bigint primary key, name varchar, description varchar, parameters varchar[][], query
text
);

The frontend to it would present the user with a choice of the NAMEs of
the records, check if PARAMETERs are required (the dimensions would be
name and datatype), if so ask for the parameters and eventually run QUERY
with these parameters.

This approach seems very logical to me, so I think someone must have
invented this weel already :-). I googled for "stored queries" but didn't
find much. I would really like tips, feedback on this approach. Is it a
bad idea, and if so, why? What pitfalls will I run into?

Thanks!