Postgres common query collection

Query the statistics information of each table in pg (applicable under inexact data count statistics):

-- Query the statistics of all tables under the public schema (estimated value)
SELECT relname, reltuples
FROM pg_class r JOIN pg_namespace n
ON (relnamespace = n.oid)
WHERE relkind = 'r' AND n.nspname = 'public';

 

postgis geometry to text, used with js behind

create or replace function geom_to_text(geometry) returns text as
$$

	select replace( replace(replace(st_astext(st_multi($1)) , 'MULTIPOLYGON(((' ,'' ) , ')))' , '' ) , ')),((' , ';')  

$$
language sql immutable ;

  

 

 

Irregularly updated later

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326181042&siteId=291194637