multicloud365
  • Home
  • Cloud Architecture
    • OCI
    • GCP
    • Azure
    • AWS
    • IAC
    • Cloud Networking
    • Cloud Trends and Innovations
    • Cloud Security
    • Cloud Platforms
  • Data Management
  • DevOps and Automation
    • Tutorials and How-Tos
  • Case Studies and Industry Insights
    • AI and Machine Learning in the Cloud
No Result
View All Result
  • Home
  • Cloud Architecture
    • OCI
    • GCP
    • Azure
    • AWS
    • IAC
    • Cloud Networking
    • Cloud Trends and Innovations
    • Cloud Security
    • Cloud Platforms
  • Data Management
  • DevOps and Automation
    • Tutorials and How-Tos
  • Case Studies and Industry Insights
    • AI and Machine Learning in the Cloud
No Result
View All Result
multicloud365
No Result
View All Result

PostgreSQL USER EXPIRE – Database Tutorials

admin by admin
April 17, 2025
in OCI
0
PostgreSQL USER EXPIRE – Database Tutorials
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


create or substitute perform expiredate(deger textual content,sayi int ,userr textual content = NULL )

RETURNS  textual content AS $$

declare

user_name textual content;

BEGIN

IF userr is not null and deger =‘+’ THEN

FOR user_name IN

choose

case when valuntil is null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date+sayi ||”‘;’

when  valuntil=‘infinity’

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”||  TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date+sayi ||”‘;’

when valuntil is not null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(valuntil,‘YYYY,MM,DD,HH24:MI’)::date+sayi ||”‘;’

finish as expiredate

from pg_user  the place  usename ‘postgres’and usename=userr LOOP

EXECUTE consumer_identify ;

END LOOP;

END IF;

IF userr is not null and  deger =‘-‘ THEN

FOR user_name IN

choose

case when valuntil is null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date–sayi ||”‘;’

when  valuntil=‘infinity’

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”||  TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date–sayi ||”‘;’

when valuntil is not null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(valuntil,‘YYYY,MM,DD,HH24:MI’)::date–sayi ||”‘;’

finish as expiredate

from pg_user  the place  usename ‘postgres’ and usename=userr LOOP

EXECUTE consumer_identify ;

END LOOP;

END IF;

IF userr is  null and deger =‘+’ THEN

FOR user_name IN

choose

case when valuntil is null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date+sayi ||”‘;’

when  valuntil=‘infinity’

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”||  TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date+sayi ||”‘;’

when valuntil is not null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(valuntil,‘YYYY,MM,DD,HH24:MI’)::date+sayi ||”‘;’

finish as expiredate

from pg_user  the place  usename ‘postgres’ LOOP

EXECUTE consumer_identify ;

END LOOP;

END IF;

IF userr is  null and deger =‘-‘ THEN

FOR user_name IN

choose

case when valuntil is null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date–sayi ||”‘;’

when  valuntil=‘infinity’

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”||  TO_CHAR(now(),‘YYYY,MM,DD,HH24:MI’)::date–sayi ||”‘;’

when valuntil is not null

then ‘ALTER USER ‘ || usename|| ‘ VALID UNTIL ‘”|| TO_CHAR(valuntil,‘YYYY,MM,DD,HH24:MI’)::date–sayi ||”‘;’

finish as expiredate

from pg_user  the place  usename ‘postgres’LOOP

EXECUTE consumer_identify ;

END LOOP;

END IF;

return  ‘ Expire süresi ‘ ||deger||”||sayi|| ‘ gün olarak  değiştirilmiştir.’;

finish;

$$ language plpgsql VOLATILE

;

Tags: DatabaseEXPIREPostgreSQLTutorialsUser
Previous Post

Underlying Causes of Low Progress

Next Post

Software program Innovation: Git – Distributed Model Management System That Modified Every part

Next Post
Software program Innovation: Git – Distributed Model Management System That Modified Every part

Software program Innovation: Git - Distributed Model Management System That Modified Every part

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Trending

AWS Licensed AI Practitioner AIF-C01 Examination Studying Path

AWS Licensed AI Practitioner AIF-C01 Examination Studying Path

January 23, 2025
FinOps For Cloud Price Optimization 101 with Finest Practices for ROI

FinOps For Cloud Price Optimization 101 with Finest Practices for ROI

March 30, 2025
From Silos to Insights: Empowering Your Knowledge-Pushed Future

From Silos to Insights: Empowering Your Knowledge-Pushed Future

January 23, 2025
Microsoft and Elon Musk’s xAI in talks to deliver Grok to Azure

Microsoft and Elon Musk’s xAI in talks to deliver Grok to Azure

May 12, 2025
How Do Knowledge Science, Machine Studying, and Synthetic Intelligence Differ and Complement Every Different?

How Do Knowledge Science, Machine Studying, and Synthetic Intelligence Differ and Complement Every Different?

April 5, 2025
Harnessing Information Lineage to Improve Information Governance Frameworks

Harnessing Information Lineage to Improve Information Governance Frameworks

May 7, 2025

MultiCloud365

Welcome to MultiCloud365 — your go-to resource for all things cloud! Our mission is to empower IT professionals, developers, and businesses with the knowledge and tools to navigate the ever-evolving landscape of cloud technology.

Category

  • AI and Machine Learning in the Cloud
  • AWS
  • Azure
  • Case Studies and Industry Insights
  • Cloud Architecture
  • Cloud Networking
  • Cloud Platforms
  • Cloud Security
  • Cloud Trends and Innovations
  • Data Management
  • DevOps and Automation
  • GCP
  • IAC
  • OCI

Recent News

Closing the cloud safety hole with runtime safety

Closing the cloud safety hole with runtime safety

May 20, 2025
AI Studio to Cloud Run and Cloud Run MCP server

AI Studio to Cloud Run and Cloud Run MCP server

May 20, 2025
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact

© 2025- https://multicloud365.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Cloud Architecture
    • OCI
    • GCP
    • Azure
    • AWS
    • IAC
    • Cloud Networking
    • Cloud Trends and Innovations
    • Cloud Security
    • Cloud Platforms
  • Data Management
  • DevOps and Automation
    • Tutorials and How-Tos
  • Case Studies and Industry Insights
    • AI and Machine Learning in the Cloud

© 2025- https://multicloud365.com/ - All Rights Reserved