Getting wrong datetime in database using insert into table query.
OS: Windows 10 Psycopg version: 2.9.9 Python version: 3.11.6 PostgreSQL version: 11 pip version : 24.0 1: what you did We are using 'psycopg2-binary' library to connect to my postgresql hosted on Azure.We have created a table named 'apilog' to store our api logs using 'Insert Into table' query.We have specifically added two columns named create_date and update_date with 'timestamp with time zone' property enabled.I only update create_date for each log locally using python and i expected update_date column to automatically update the datetime when the transaction is committed at the end in python. 2: what you expected to happen I expected to see update_date column returning datetime values which are similar to the time the transaction is committed in python however instead the value seems to returning datetime which is more closer to the time db connection is established. 3: what happened instead The datetime value in update_date is coming earlier than the create_date value of even the very first log which is creating discrepancy and making it difficult to track the exact time logs are committed into database. For example: This query INSERT INTO api_log(log_detail,create_date) VALUES('example log 1', datetime.datetime.utcnow'),('example log 2', datetime.datetime.utcnow') Should ideally return update_date which is older than 'example log 2' create_date but it is returning a datetime which is even earlier than 'example log 1' create_date.
Not able to grant access on pg_signal_backend on azure flexible server
Hi, We have created an azure postgresql flexible server and we have added an ad admin as a user and Created our database using this admin user.However,When are running this command: 'Grant pg_signal_backend To adminUser' we are getting an error that says 'permission denied to grant role "pg_signal_backend".While this is strange the admin user is infact the owner of the said database and we don't have any other user that have the said privileges.
Re: Not able to grant access on pg_signal_backend on azure flexible server
Hi, I am afraid that's not the case with postgresql 16 since we also tested with postgresql 15 we are able to run this command( "GRANT pg_signal_backend To "our_admin_user") successfully with our admin user but that's not the case with postgresql 16 we keep getting the error message 'permission denied to grant role "pg_signal_backend".Also,In postgre 16 only the current users of the database are able to close the connections.Can you help on this please? On Fri, 19 Apr 2024, 19:50 Adrian Klaver, wrote: > On 4/18/24 22:48, Saksham Joshi wrote: > > Hi, > > We have created an azure postgresql flexible server and we have added an > > ad admin as a user and Created our database using this admin > > user.However,When are running this command: 'Grant pg_signal_backend To > > adminUser' we are getting an error that says 'permission denied to grant > > role "pg_signal_backend".While this is strange the admin user is infact > > the owner of the said database and we don't have any other user that > > have the said privileges. > > > https://www.postgresql.org/docs/current/predefined-roles.html > > "PostgreSQL provides a set of predefined roles that provide access to > certain, commonly needed, privileged capabilities and information. > Administrators (including roles that have the CREATEROLE privilege) can > GRANT these roles to users and/or other roles in their environment, > providing those users with access to the specified capabilities and > information." > > > > > -- > Adrian Klaver > adrian.kla...@aklaver.com > >
Re: Not able to grant access on pg_signal_backend on azure flexible server
Hi David, We have tried granting it with our admin user also but no avail. On Mon, 22 Apr 2024, 10:50 David G. Johnston, wrote: > On Sunday, April 21, 2024, Saksham Joshi wrote: > >> Hi, >> I am afraid that's not the case with postgresql 16 since we also tested >> with postgresql 15 we are able to run this command( "GRANT >> pg_signal_backend To "our_admin_user") successfully with our admin user but >> that's not the case with postgresql 16 we keep getting the error message >> 'permission denied to grant role "pg_signal_backend". >> > > Probably you haven’t granted pg_signal_backend to whichever role you are > executing the above grant command with. One cannot grant what one does not > have themselves, with the admin option. > > David J. > >