X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id F3E40D1B453 for ; Tue, 23 Dec 2003 09:32:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63102-04 for ; Tue, 23 Dec 2003 05:31:36 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 388E9D1B477 for ; Tue, 23 Dec 2003 05:31:34 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hBN9VUU6049436 for ; Tue, 23 Dec 2003 09:31:30 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hBN9PvK8047502 for pgsql-sql@postgresql.org; Tue, 23 Dec 2003 09:25:57 GMT From: Joop X-Newsgroups: comp.databases.postgresql.sql Subject: stored queries Date: Tue, 23 Dec 2003 10:25:42 +0100 Organization: Hub.Org Networking Services Lines: 25 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/171 X-Sequence-Number: 16337 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!