Skip to content

Commit

Permalink
Update Postgres_SqlInjecttions.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
libertyir authored Sep 18, 2021
1 parent 811854d commit 24532ff
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Postgres_SqlInjecttions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,28 @@ insert into table1 values ('c');
Select string_agg(txt,',') from Table1 -- result a,b,c


--database staructs
--database structure
--*********************************
--return database list

select datname from pg_database
select string_agg(datname,',') from pg_database --result all database name in separated string

--*****

--return tables
select table_name from information_schema.tables
select string_agg(table_name, ',') from information_schema.tables

--return columns
select column_name from information_schema.columns where table_name = 'tablename'
select string_agg(column_name, ',') from information_schema.columns where table_name = 'tablename'

--return tables and fields
select (table_name || ' : ' || (select string_agg(column_name, ',') from information_schema.columns _c where _c.table_name = _t.table_name)) as txt1 from information_schema.tables _t
--sapmle result
------------------------------------
--| table1 : field1,field2,field3 |
--| table2 : field1 |
------------------------------------



Expand Down

0 comments on commit 24532ff

Please sign in to comment.