Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

DB_PARTITION

Represents information of partitioned classes for which the current user has access authorization in the database.

Attribute Name

Data Type

Description

class_name

VARCHAR(255)

Class name

partition_name

VARCHAR(255)

Partition name

partition_class_name

VARCHAR(255)

Partitioned class name

partition_type

VARCHAR(32)

Partition type
(HASH, RANGE, LIST)

partition_expr

VARCHAR(255)

Partition expression

partition_values

SEQUENCE OF

RANGE ? MIN/MAX value
- For infinite MIN/MAX, NULL
LIST - value list

Definition

CREATE VCLASS db_partition

(sp_name, sp_type, return_type, arg_count, lang, target, owner)

AS

SELECT p.class_of.class_name AS class_name, p.pname AS partition_name,

            p.class_of.class_name || '__p__' || p.pname AS partition_class_name,

            CASE WHEN p.ptype = 0 THEN 'HASH'

                 WHEN p.ptype = 1 THEN 'RANGE'

            ELSE 'LIST' ENDASpartition_type,

            TRIM(SUBSTRING( pi.pexpr FROM 8 FOR (POSITION(' FROM ' IN pi.pexpr)-8))) AS

               partition_expression,

            p.pvalues AS partition_values

FROM _db_partition p,

     ( select * from _db_partition sp

where sp.class_of =  p.class_of AND sp.pname is null) pi

WHERE p.pname is not null AND

      ( CURRENT_USER = 'DBA'

        OR

        {p.class_of.owner.name} SUBSETEQ

         ( SELECT SET{CURRENT_USER} + COALESCE(SUM(SET{t.g.name}), SET{})

           FROM db_user u, TABLE(groups) AS t(g) 

           WHERE u.name = CURRENT_USER

         )

        OR

        {p.class_of} SUBSETEQ

         ( SELECT SUM(SET{au.class_of}) 

           FROM _db_auth au 

           WHERE {au.grantee.name} SUBSETEQ

                 ( SELECT SET{CURRENT_USER} + COALESCE(SUM(SET{t.g.name}), SET{}) 

                   FROM db_user u, TABLE(groups) AS t(g) 

                   WHERE u.name = CURRENT_USER) AND 

                   au.auth_type = 'SELECT'

         )

      )

Example

The following is an example of retrieving the partition information currently configured for the participant2 class (see examples in Defining Range Partitions).

csql> select * from db_partition where class_name = 'participant2';

csql> ;x

 

=== <Result of SELECT Command in Line 2> ===

 

  class_name            partition_name        partition_class_name         partition_type   partition_expr        partition_values

====================================================================================================================================

  'participant2'        'before_2000'         'participant2__p__before_2000'  'RANGE'       'host_year'           {NULL, 2000}

  'participant2'        'before_2008'         'participant2__p__before_2008'  'RANGE'       'host_year'           {2000, 2008}