equal
deleted
inserted
replaced
65 ================ |
65 ================ |
66 :: |
66 :: |
67 |
67 |
68 SELECT * FROM pg_available_extensions; |
68 SELECT * FROM pg_available_extensions; |
69 |
69 |
|
70 Grant role options |
|
71 ================== |
|
72 :: |
|
73 |
|
74 ALTER USER me WITH SUPERUSER; |
|
75 ALTER USER me WITH CREATEDB CREATEROLE LOGIN; |
|
76 |
|
77 https://www.postgresql.org/docs/current/sql-createrole.html |
|
78 ``CREATE ROLE``. |
|
79 |
|
80 Change password |
|
81 =============== |
|
82 :: |
|
83 |
|
84 ALTER USER me WITH PASSWORD 'PassWord'; |
|
85 |
70 List databases, schemas and tables |
86 List databases, schemas and tables |
71 ================================== |
87 ================================== |
72 |
88 |
73 Default database is ``postgres``. |
89 Default database is ``postgres``. |
74 |
90 |
118 \di |
134 \di |
119 select * from pg_indexes; |
135 select * from pg_indexes; |
120 select * from pg_indexes where schemaname = '...'; |
136 select * from pg_indexes where schemaname = '...'; |
121 select * from pg_indexes where schemaname = '...' and tablename = '...'; |
137 select * from pg_indexes where schemaname = '...' and tablename = '...'; |
122 select * from pg_indexes where schemaname = '...' and indexname = '...'; |
138 select * from pg_indexes where schemaname = '...' and indexname = '...'; |
|
139 |
|
140 select |
|
141 t.relname as table_name, |
|
142 i.relname as index_name, |
|
143 a.attname as column_name |
|
144 from |
|
145 pg_class t, |
|
146 pg_class i, |
|
147 pg_index ix, |
|
148 pg_attribute a |
|
149 where |
|
150 t.oid = ix.indrelid |
|
151 and i.oid = ix.indexrelid |
|
152 and a.attrelid = t.oid |
|
153 and a.attnum = ANY(ix.indkey) |
|
154 and t.relkind = 'r' |
|
155 and t.relname like 'test%' |
|
156 order by |
|
157 t.relname, |
|
158 i.relname; |
|
159 |
|
160 select |
|
161 t.relname as table_name, |
|
162 i.relname as index_name, |
|
163 array_to_string(array_agg(a.attname), ', ') as column_names |
|
164 from |
|
165 pg_class t, |
|
166 pg_class i, |
|
167 pg_index ix, |
|
168 pg_attribute a |
|
169 where |
|
170 t.oid = ix.indrelid |
|
171 and i.oid = ix.indexrelid |
|
172 and a.attrelid = t.oid |
|
173 and a.attnum = ANY(ix.indkey) |
|
174 and t.relkind = 'r' |
|
175 and t.relname like 'test%' |
|
176 group by |
|
177 t.relname, |
|
178 i.relname |
|
179 order by |
|
180 t.relname, |
|
181 i.relname; |
123 |
182 |
124 List functions:: |
183 List functions:: |
125 |
184 |
126 \df |
185 \df |
127 |
186 |