Question

Enabled `moddatetime` extension on managed Postgres cluster

Hey there, I need to enable the moddatetime extension on my managed Postgres cluster but I can’t do it using doadmin and neither can I grant the admin user superuser privileges. How could I go about it?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 22, 2025

Hey,

As far as I can see this is not part of the supported extensions based on the list here:

https://docs.digitalocean.com/products/databases/postgresql/details/supported-extensions/

But feel free to reach out to the DigitalOcean support team to see if they could by any chance enable it for you on their end:

https://www.digitalocean.com/support/

Hope that helps!

- Bobby.

Hey Bobby,

Thanks for that, yea I checked with DO support and seems like it is unsupported.

If anybody else runs into the same issue, I’ve resolved it by adding function which implements moddatetime if the extension is not available, see: https://stackoverflow.com/a/76092474

DO $SETUP_MODDATETIME$
BEGIN
  CREATE EXTENSION IF NOT EXISTS "moddatetime";
EXCEPTION WHEN INSUFFICIENT_PRIVILEGE THEN
  -- Unable to use moddatetime extension, so create a function instead
  CREATE OR REPLACE FUNCTION moddatetime() RETURNS trigger LANGUAGE plpgsql AS $moddatetime$
    DECLARE
      colname name;
    BEGIN
      IF (TG_NARGS = 1) THEN
        colname = TG_ARGV[0];
      ELSE
        RAISE EXCEPTION 'moddatetime(colname) requires one argument';
      END IF;

      RETURN json_populate_record(NEW, json_build_object(colname, NOW()));
    END;
  $moddatetime$;
END $SETUP_MODDATETIME$;
KFSys
Site Moderator
Site Moderator badge
February 23, 2025

Heya,

The extension moddatetime should already be available! If that is not the case, you’ll need to reach to DigitalOcean support.

https://www.digitalocean.com/support/

If you have a ticket reference, post it here, we can try and speed things up for you.

Hope that helps! - KFSys.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.