Re: Can user specification of a column value be required when querying a view ? - Mailing list pgsql-general

From Steve Baldwin
Subject Re: Can user specification of a column value be required when querying a view ?
Date
Msg-id CAKE1AiZ4rgr4-MPowDH22NjY5e6iuph7JGXCG2AadPK7YS8_Aw@mail.gmail.com
Whole thread Raw
In response to Can user specification of a column value be required when querying a view ?  (David Gauthier <dfgpostgres@gmail.com>)
List pgsql-general
Maybe you could create a function that has a required parameter, so rather than 'select * from huge_view where .." they do 'select * from function(some_ssn) [where...]' ?

That function would then query the view using the supplied ssn.

Just a thought.

Steve

On Tue, Nov 21, 2023 at 8:41 AM David Gauthier <dfgpostgres@gmail.com> wrote:
Hi:

I have a view that I want  to require user specification for a specific column before the query starts (if that makes sense).  

Example
I want the users to be required to provide a value for ssn in the following query... 
"select * from huge_view where ssn = '106-91-9930' "
I never want them to query the view without specifying ssn.
It has to do with resources and practicality.

Is there a way to do that ?
Thanks

pgsql-general by date:

Previous
From: David Gauthier
Date:
Subject: Can user specification of a column value be required when querying a view ?
Next
From: Christophe Pettus
Date:
Subject: Re: Can user specification of a column value be required when querying a view ?