如何从postgres DB的所有数据库中列出所有表名?
使用模式名称(数据库)
我试过了
classess = [ [13, 15], [11, 13], [4, 7], [2, 4], [3, 6] ]
# construct a action list:
# action[0] -> time of action
# action[1] -> type of action (-1 for finish type, 1 for start type)
actions = []
for cla55 in classess:
actions.append([cla55[0], 1])
actions.append([cla55[1], -1])
actions.sort()
# [[2, 1], [3, 1], [4, -1], [4, 1], [6, -1], [7, -1], [11, 1], [13, -1], [13, 1], [15, -1]]
min_classrooms = 0
curr_classrooms = 0
for action in actions:
curr_classrooms += action[1]
if curr_classrooms > min_classrooms:
min_classrooms = curr_classrooms
print(min_classrooms)
和
select *
from information_schema.tables
where table_schema = 'public'
它只显示当前的选择数据库列;