New answers tagged

0

You should get the maximum value from c.pay then: Select b.enumber, b.bday, max(c.pay) as current_pay From employee b inner join humanr c on b.empid = c.empid group by b.enumber, b.bday


3

There are many ways to do this. Many will work both in SQL Server and Postgres, like using the ROW_NUMBER() function: WITH cte AS ( SELECT e.enumber, e.bday, c.empid, c.pay, ROW_NUMBER() OVER (PARTITION BY c.empid ORDER BY c.id DESC) AS rn FROM employee AS e INNER JOIN humanr AS c ON e.empid = ...


0

For databases dumped with pg_dumpall it is best to use pg_restore --create instead of psql.


0

pg_dumpall requires all tablespaces exist, otherwise database creation will fail for databases in non-default locations.


1

To get all members of all roles: SELECT r.rolname as username,r1.rolname as "role" FROM pg_catalog.pg_roles r JOIN pg_catalog.pg_auth_members m ON (m.member = r.oid) JOIN pg_roles r1 ON (m.roleid=r1.oid) WHERE r.rolcanlogin ORDER BY 1; Add r1.rolname='council_stuff' to filter on only that one. Be aware that users ...


1

From this post: ;WITH CTE AS ( SELECT table_name , ( SELECT MAX(pg_ls_dir::int)::text FROM pg_ls_dir('./base') WHERE pg_ls_dir <> 'pgsql_tmp' AND pg_ls_dir::int <= (SELECT relfilenode FROM pg_class WHERE relname ILIKE table_name) ) as folder ...


0

I was running into similar issues with pgAgent all the time, as at my company we used it pretty heavily. The reason it stays "running" is because the pgAgent service crashed and was unable to update the logging row. Like tkrennwa said, that was most likely caused by that bug. The issue is, i've run into too many of those types of bugs with pgAgent where ...



Top 50 recent answers are included