PostgreSQL functions inside where clause
For every table that is created a type with the same name is created. So you you can define your function to accept the table's type. 

Such a function is also better written as a SQL function to avoid the overhead of PL/pgSQL. 

create function my_function(val a) returns boolean as 
 $$
 select val.p1 is not null 
    and val.p2 is not null
    and val.p3 is not null;
 $$ 
 language sql
 stable;


The a in (val a) is the name of your table.

You can use that function in the following way:

select * 
from a
where my_function(a);