Quantcast
Channel: SCN : All Content - SAP IQ
Viewing all articles
Browse latest Browse all 716

[Share] Error in making a hash partitioned table

$
0
0

While investigating a customer's problem, I found another unexpected error in making a hash paritioned table.
IQ server returned an error "Cannot add a partition or subpartition to table bar" against an "alter table... partition by hash..." statement.

 

[Reproduction]
1. Create a table.
CREATE TABLE bar (
      c1 bigint NOT NULL,
      c2 char(2) NULL,
      c3 date NULL,
      c4 varchar(200) NULL,
      PRIMARY KEY (c1)
) IN DBS01 ;

 

2. Run the alter table statement.
Alter table bar partition by hash (c2) ;

 

3. Error message
I. 01/06 10:18:47. 0001739559 Exception Thrown from dblib/db_alter.cxx:845, Err# 261, tid 6 origtid 6
I. 01/06 10:18:47. 0001739559    O/S Err#: 0, ErrID: 4098 (db_sqlexception); SQLCode: -1013122, SQLState: 'QDD30', Severity: 14
I. 01/06 10:18:47. 0001739559 [22152]: Cannot add a partition or subpartition to table bar

 

According to IQ manual, there are some restrictions regarding hash paritioning as below.
- You can only hash partition a base table. Attempting to partitioning a global temporary table or a local temporary table raises an error.
- You can only subpartition a hash-partitioned table by range if the the table is empty.
- You cannot add, drop, merge, or split a hash partition.
- You cannot add or drop a column from a hash partition key.

 

The "alter table" statement I ran does not match with any restrictions above, but failed.

So, this problem is logged CR776888 and under investigation by engineering team.

 

A workaround to make a hash partitioned table is,

1) Extract the table data, if needed.
2) Drop the table.
3) Recreate it with new partition key(s) within "create table ..." statement.
    CREATE TABLE bar (
      c1 bigint NOT NULL,
      c2 char(2) NULL,
      c3 date NULL,
      c4 varchar(200) NULL,
      PRIMARY KEY (c1)
     ) IN DBS01
     partition by hash(c2);

4) Load the extracted data, if needed.

 

Please refer to the IQ manual page below explaining about the hash partitioning.
http://help.sap.com/saphelp_iq1608_iqrefso/helpdata/en/a6/136fd584f21015a0afcf632ba5877d/content.htm?frameset=/en/a8/90e66f84f210158e8f869393336af4/frameset.htm&current_toc=/en/a8/90e66f84f210158e8f869393336af4/plain.htm&node_id=32

 

HTH
Jerry


Viewing all articles
Browse latest Browse all 716


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>