@@ -435,7 +435,7 @@ class TPgTableContent : public TMutableComputationNode<TPgTableContent> {
435
435
{" rolname" , [](ui32 index ) {
436
436
return PointerDatumToPod ((Datum)MakeFixedString (index == 1 ? " postgres" : *PGGetGUCSetting (" ydb_user" ), NAMEDATALEN));
437
437
}},
438
- {" oid" , [](ui32) { return ScalarDatumToPod (ObjectIdGetDatum (1 )); }},
438
+ {" oid" , [](ui32 index ) { return ScalarDatumToPod (ObjectIdGetDatum (index )); }},
439
439
{" rolbypassrls" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
440
440
{" rolsuper" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
441
441
{" rolinherit" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
@@ -453,6 +453,26 @@ class TPgTableContent : public TMutableComputationNode<TPgTableContent> {
453
453
};
454
454
455
455
ApplyFillers (AllPgRolesFillers, Y_ARRAY_SIZE (AllPgRolesFillers), PgRolesFillers_);
456
+ } else if (Table_ == " pg_user" ) {
457
+ static const std::pair<const char *, TPgUserFiller> AllPgUserFillers[] = {
458
+ {" usename" , [](ui32 index ) {
459
+ return PointerDatumToPod ((Datum)MakeFixedString (index == 1 ? " postgres" : *PGGetGUCSetting (" ydb_user" ), NAMEDATALEN));
460
+ }},
461
+ {" usesysid" , [](ui32 index ) { return ScalarDatumToPod (ObjectIdGetDatum (index )); }},
462
+ {" usecreatedb" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
463
+ {" usesuper" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
464
+ {" userepl" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
465
+ {" usebypassrls" , [](ui32) { return ScalarDatumToPod (BoolGetDatum (true )); }},
466
+ {" passwd" , [](ui32) { return NUdf::TUnboxedValuePod (); }},
467
+ {" valuntil" , [](ui32) { return NUdf::TUnboxedValuePod (); }},
468
+ {" useconfig" , [](ui32) { return PointerDatumToPod (MakeArrayOfText ({
469
+ " search_path=public" ,
470
+ " default_transaction_isolation=serializable" ,
471
+ " standard_conforming_strings=on" ,
472
+ })); }},
473
+ };
474
+
475
+ ApplyFillers (AllPgUserFillers, Y_ARRAY_SIZE (AllPgUserFillers), PgUserFillers_);
456
476
} else if (Table_ == " pg_stat_database" ) {
457
477
static const std::pair<const char *, TPgDatabaseStatFiller> AllPgDatabaseStatFillers[] = {
458
478
{" datid" , [](ui32 index ) { return ScalarDatumToPod (ObjectIdGetDatum (index ? 3 : 0 )); }},
@@ -801,6 +821,20 @@ class TPgTableContent : public TMutableComputationNode<TPgTableContent> {
801
821
}
802
822
}
803
823
824
+ sysFiller.Fill (items);
825
+ rows.emplace_back (row);
826
+ }
827
+ } else if (Table_ == " pg_user" ) {
828
+ ui32 tableSize = PGGetGUCSetting (" ydb_user" ) ? 2 : 1 ;
829
+ for (ui32 index = 1 ; index <= tableSize; ++index ) {
830
+ NUdf::TUnboxedValue* items;
831
+ auto row = compCtx.HolderFactory .CreateDirectArrayHolder (PgUserFillers_.size (), items);
832
+ for (ui32 i = 0 ; i < PgUserFillers_.size (); ++i) {
833
+ if (PgUserFillers_[i]) {
834
+ items[i] = PgUserFillers_[i](index );
835
+ }
836
+ }
837
+
804
838
sysFiller.Fill (items);
805
839
rows.emplace_back (row);
806
840
}
@@ -956,6 +990,8 @@ class TPgTableContent : public TMutableComputationNode<TPgTableContent> {
956
990
TVector<TPgAmFiller> PgAmFillers_;
957
991
using TPgRolesFiller = NUdf::TUnboxedValuePod(*)(ui32 index);
958
992
TVector<TPgRolesFiller> PgRolesFillers_;
993
+ using TPgUserFiller = NUdf::TUnboxedValuePod(*)(ui32 index);
994
+ TVector<TPgUserFiller> PgUserFillers_;
959
995
using TPgDatabaseStatFiller = NUdf::TUnboxedValuePod(*)(ui32 index);
960
996
TVector<TPgDatabaseStatFiller> PgDatabaseStatFillers_;
961
997
0 commit comments