Search code examples
sqlpostgresqlvalidationbooleanroles

POSTGRESQL: query that returns a column named valid with a boolean value that tells whether the limited ( name of role ) role password has expired


Like in Title, I have made so far

SELECT rolvaliduntil AS "valid" 
FROM pg_authid
WHERE rolname = 'limited'
AND rolvaliduntil > now();

I think this is not so hard but I cant find any method. Here is an image of what I would like to achieve

enter image description here


Solution

  • Just add it to the SELECT list:

    SELECT rolvaliduntil > now() AS "valid" 
    FROM pg_authid
    WHERE rolname = 'limited'