How to retrieve the partition info for each partition table?

2018-10-24 Thread Yuxia Qiu
HI,

   I have created some partition table, as example bellow:
CREATE TABLE public.measurement
(
city_id integer NOT NULL,
logdate date NOT NULL,
peaktemp integer,
unitsales integer
) PARTITION BY RANGE (logdate) ;

CREATE TABLE public.measurement_y2006m02 PARTITION OF public.measurement
FOR VALUES FROM ('2006-02-01') TO ('2006-03-01');

CREATE TABLE public.measurement_y2006m03 PARTITION OF public.measurement
FOR VALUES FROM ('2006-03-01') TO ('2006-04-01');

I know how to get a list partition tables for above example by calling :

SELECT i.inhrelid::regclass AS child

FROM   pg_inherits i

WHERE  i.inhparent = 'public.measurement'::regclass;


My question is: how to get the value boundary for each partition table like
bellow?

measurement_y2006m02   FROM ('2006-02-01') TO ('2006-03-01')

measurement_y2006m03   FROM ('2006-03-01') TO ('2006-04-01')


Thanks,

Yuxia


How to get partition info for a partition table?

2018-10-26 Thread Yuxia Qiu
HI Dear PostgreSQL,

 I am pretty new for this DB.
 I have created two partition tables as bellow:
*CREATE TABLE* measurement_year_month (
 logdate date not null,
 peaktemp int,
 unitsales int
) PARTITION BY RANGE (EXTRACT(YEAR FROM logdate), EXTRACT(MONTH FROM
 logdate));

*create table* partitionTest(
  firstname  varchar[20],
  lastName   varchar[20],
  id int
)
partition by range (id, firstname);

*My question is:* how do I retrieve the information like bellow?
*Table name**Partition type *  * Partition
information*
 measurement_year_month   Range  (EXTRACT(YEAR FROM
logdate), EXTRACT(MONTH FROM logdate)
partitionTestRange  (id,
firstname)

Thanks in advance.

Regards,
Yuxia


Question about partition table

2018-10-26 Thread Yuxia Qiu
HI Dear PostgreSQL team,

   I have created a partition table as bellow:
   *CREATE TABLE* measurement_year_month (
 logdate date not null,
 peaktemp int,
 unitsales int
) PARTITION BY RANGE (EXTRACT(YEAR FROM logdate), EXTRACT(MONTH FROM
 logdate));

so the content for this  column *partexprs* for this table  in
pg_partitioned_table will be:

({FUNCEXPR :funcid 1384 :funcresulttype 701 :funcretset false :funcvariadic
false :funcformat 0 :funccollid 0 :inputcollid 100 :args ({CONST :consttype
25 :consttypmod -1 :constcollid 100 :constlen -1 :constbyval false
:constisnull false :location 122 :constvalue 8 [ 32 0 0 0 121 101 97 114 ]}
{VAR :varno 1 :varattno 1 :vartype 1082 :vartypmod -1 :varcollid 0
:varlevelsup 0 :varnoold 1 :varoattno 1 :location 132}) :location 114}
{FUNCEXPR :funcid 1384 :funcresulttype 701 :funcretset false :funcvariadic
false :funcformat 0 :funccollid 0 :inputcollid 100 :args ({CONST :consttype
25 :consttypmod -1 :constcollid 100 :constlen -1 :constbyval false
:constisnull false :location 150 :constvalue 9 [ 36 0 0 0 109 111 110 116
104 ]} {VAR :varno 1 :varattno 1 :vartype 1082 :vartypmod -1 :varcollid 0
:varlevelsup 0 :varnoold 1 :varoattno 1 :location 162}) :location 142})

My question is: Can I get string value from this column? and how?
In the end I want to have the bellow result:


*Table name* *Partition
information*
measurement_year_month(EXTRACT(YEAR FROM logdate),
EXTRACT(MONTH FROM  logdate))


Your help is highly appreciated.

Thanks,
Yuxia