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?
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!
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:
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$;
Heya,
The extension moddatetime
should already be available! If that is not the case, you’ll need to reach to DigitalOcean support.
If you have a ticket reference, post it here, we can try and speed things up for you.
Hope that helps! - KFSys.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.