@@ -46,7 +46,6 @@ namespace pg {
4646bool use_parallel_workers = false ;
4747bool use_deeplake_executor = true ;
4848bool explain_query_before_execute = false ;
49- bool ignore_primary_keys = true ;
5049bool print_runtime_stats = false ;
5150bool support_json_index = false ;
5251bool is_filter_pushdown_enabled = true ;
@@ -133,17 +132,6 @@ void initialize_guc_parameters()
133132 nullptr // check_hook, assign_hook, show_hook
134133 );
135134
136- DefineCustomBoolVariable (" pg_deeplake.ignore_primary_keys" ,
137- " If set to true, PRIMARY KEY constraints will be ignored during table creation." ,
138- nullptr , // optional long description
139- &pg::ignore_primary_keys, // linked C variable
140- true , // default value
141- PGC_USERSET , // context (USERSET, SUSET, etc.)
142- 0 , // flags
143- nullptr ,
144- nullptr ,
145- nullptr // check_hook, assign_hook, show_hook
146- );
147135
148136 DefineCustomBoolVariable (" pg_deeplake.print_runtime_stats" ,
149137 " Enable runtime statistics printing for pg_deeplake operations." ,
@@ -625,70 +613,6 @@ static void process_utility(PlannedStmt* pstmt,
625613 list_free_deep (stmt->options );
626614 stmt->options = NIL ;
627615 }
628- // Remove PRIMARY KEY constraints
629- if (pg::ignore_primary_keys && deeplake_table && stmt->tableElts != nullptr ) {
630- List* new_table_elts = NIL ;
631- ListCell* lc = nullptr ;
632- bool has_primary_key = false ;
633- // Get table name from the CreateStmt
634- std::string table_name = stmt->relation ? stmt->relation ->relname : " " ;
635- std::map<std::string, std::set<std::string>> primary_keys;
636- foreach (lc, stmt->tableElts ) {
637- Node* element = (Node*)lfirst (lc);
638- // Handle table-level PRIMARY KEY constraints
639- if (IsA (element, Constraint)) {
640- Constraint* constraint = (Constraint*)element;
641- if (constraint->contype == CONSTR_PRIMARY ) {
642- has_primary_key = true ;
643- // Extract primary key column names
644- if (constraint->keys != nullptr ) {
645- ListCell* key_lc = nullptr ;
646- foreach (key_lc, constraint->keys ) {
647- std::string col_name = strVal (lfirst (key_lc));
648- elog (DEBUG1 ,
649- " Removing table-level PRIMARY KEY constraint on table '%s' for column: %s" ,
650- table_name.c_str (),
651- col_name.c_str ());
652- primary_keys[table_name].insert (col_name);
653- }
654- }
655- continue ; // Skip adding this constraint
656- }
657- }
658-
659- // Handle column-level PRIMARY KEY constraints (e.g., "col INT PRIMARY KEY")
660- if (IsA (element, ColumnDef)) {
661- ColumnDef* coldef = (ColumnDef*)element;
662- if (coldef->constraints != nullptr ) {
663- List* new_constraints = NIL ;
664- ListCell* const_lc = nullptr ;
665-
666- foreach (const_lc, coldef->constraints ) {
667- Constraint* constraint = (Constraint*)lfirst (const_lc);
668- if (constraint->contype == CONSTR_PRIMARY ) {
669- has_primary_key = true ;
670- elog (DEBUG1 ,
671- " Removing column-level PRIMARY KEY constraint on table '%s' for column: %s" ,
672- table_name.c_str (),
673- coldef->colname );
674- primary_keys[table_name].insert (coldef->colname );
675- continue ;
676- }
677- new_constraints = lappend (new_constraints, constraint);
678- }
679-
680- // Update column's constraints list
681- coldef->constraints = new_constraints;
682- }
683- }
684-
685- new_table_elts = lappend (new_table_elts, element);
686- }
687- if (has_primary_key) {
688- stmt->tableElts = new_table_elts;
689- pg::table_storage::instance ().set_primary_keys (std::move (primary_keys));
690- }
691- }
692616 }
693617
694618 std::optional<pg::utils::parallel_workers_switcher> switcher;
0 commit comments