LCOV - code coverage report
Current view: top level - src/include/utils - partcache.h (source / functions) Hit Total Coverage
Test: PostgreSQL 13beta1 Lines: 14 14 100.0 %
Date: 2020-05-29 01:06:25 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * partcache.h
       4             :  *
       5             :  * Copyright (c) 1996-2020, PostgreSQL Global Development Group
       6             :  *
       7             :  * src/include/utils/partcache.h
       8             :  *
       9             :  *-------------------------------------------------------------------------
      10             :  */
      11             : #ifndef PARTCACHE_H
      12             : #define PARTCACHE_H
      13             : 
      14             : #include "access/attnum.h"
      15             : #include "fmgr.h"
      16             : #include "nodes/pg_list.h"
      17             : #include "nodes/primnodes.h"
      18             : #include "partitioning/partdefs.h"
      19             : #include "utils/relcache.h"
      20             : 
      21             : /*
      22             :  * Information about the partition key of a relation
      23             :  */
      24             : typedef struct PartitionKeyData
      25             : {
      26             :     char        strategy;       /* partitioning strategy */
      27             :     int16       partnatts;      /* number of columns in the partition key */
      28             :     AttrNumber *partattrs;      /* attribute numbers of columns in the
      29             :                                  * partition key or 0 if it's an expr */
      30             :     List       *partexprs;      /* list of expressions in the partitioning
      31             :                                  * key, one for each zero-valued partattrs */
      32             : 
      33             :     Oid        *partopfamily;   /* OIDs of operator families */
      34             :     Oid        *partopcintype;  /* OIDs of opclass declared input data types */
      35             :     FmgrInfo   *partsupfunc;    /* lookup info for support funcs */
      36             : 
      37             :     /* Partitioning collation per attribute */
      38             :     Oid        *partcollation;
      39             : 
      40             :     /* Type information per attribute */
      41             :     Oid        *parttypid;
      42             :     int32      *parttypmod;
      43             :     int16      *parttyplen;
      44             :     bool       *parttypbyval;
      45             :     char       *parttypalign;
      46             :     Oid        *parttypcoll;
      47             : }           PartitionKeyData;
      48             : 
      49             : 
      50             : extern PartitionKey RelationGetPartitionKey(Relation rel);
      51             : extern List *RelationGetPartitionQual(Relation rel);
      52             : extern Expr *get_partition_qual_relid(Oid relid);
      53             : 
      54             : /*
      55             :  * PartitionKey inquiry functions
      56             :  */
      57             : static inline int
      58        5252 : get_partition_strategy(PartitionKey key)
      59             : {
      60        5252 :     return key->strategy;
      61             : }
      62             : 
      63             : static inline int
      64        6550 : get_partition_natts(PartitionKey key)
      65             : {
      66        6550 :     return key->partnatts;
      67             : }
      68             : 
      69             : static inline List *
      70       10770 : get_partition_exprs(PartitionKey key)
      71             : {
      72       10770 :     return key->partexprs;
      73             : }
      74             : 
      75             : /*
      76             :  * PartitionKey inquiry functions - one column
      77             :  */
      78             : static inline int16
      79        1322 : get_partition_col_attnum(PartitionKey key, int col)
      80             : {
      81        1322 :     return key->partattrs[col];
      82             : }
      83             : 
      84             : static inline Oid
      85        7622 : get_partition_col_typid(PartitionKey key, int col)
      86             : {
      87        7622 :     return key->parttypid[col];
      88             : }
      89             : 
      90             : static inline int32
      91        7530 : get_partition_col_typmod(PartitionKey key, int col)
      92             : {
      93        7530 :     return key->parttypmod[col];
      94             : }
      95             : 
      96             : static inline Oid
      97        7530 : get_partition_col_collation(PartitionKey key, int col)
      98             : {
      99        7530 :     return key->partcollation[col];
     100             : }
     101             : 
     102             : #endif                          /* PARTCACHE_H */

Generated by: LCOV version 1.13