@@ -63,48 +63,47 @@ func HasDoltCIPrefix(s string) bool {
6363
6464// IsFullTextTable returns a boolean stating whether the given table is one of the pseudo-index tables used by Full-Text
6565// indexes.
66- // TODO: Schema name
67- func IsFullTextTable (name string ) bool {
68- return HasDoltPrefix (name ) && (strings .HasSuffix (name , "_fts_config" ) ||
66+ func IsFullTextTable (name string , isSystemTable bool ) bool {
67+ return isSystemTable && (strings .HasSuffix (name , "_fts_config" ) ||
6968 strings .HasSuffix (name , "_fts_position" ) ||
7069 strings .HasSuffix (name , "_fts_doc_count" ) ||
7170 strings .HasSuffix (name , "_fts_global_count" ) ||
7271 strings .HasSuffix (name , "_fts_row_count" ))
7372}
7473
7574// IsDoltCITable returns whether the table name given is a dolt-ci table
76- func IsDoltCITable (name string ) bool {
77- return HasDoltCIPrefix (name ) && set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name )
75+ func IsDoltCITable (name string , isSystemTable bool ) bool {
76+ return HasDoltCIPrefix (name ) && set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name , isSystemTable )
7877}
7978
8079// IsReadOnlySystemTable returns whether the table name given is a system table that should not be included in command line
8180// output (e.g. dolt status) by default.
82- func IsReadOnlySystemTable (name string ) bool {
83- return HasDoltPrefix ( name ) && ! set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name )
81+ func IsReadOnlySystemTable (name string , isSystemTable bool ) bool {
82+ return isSystemTable && ! set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name , isSystemTable )
8483}
8584
8685// IsNonAlterableSystemTable returns whether the table name given is a system table that cannot be dropped or altered
8786// by the user.
88- func IsNonAlterableSystemTable (name string ) bool {
89- return (IsReadOnlySystemTable (name ) && ! IsFullTextTable (name )) || strings .EqualFold (name , SchemasTableName )
87+ func IsNonAlterableSystemTable (name string , isSystemTable bool ) bool {
88+ return (IsReadOnlySystemTable (name , isSystemTable ) && ! IsFullTextTable (name , isSystemTable )) || strings .EqualFold (name , GetSchemasTableName () )
9089}
9190
9291// GetNonSystemTableNames gets non-system table names
93- func GetNonSystemTableNames (ctx context.Context , root RootValue ) ([]string , error ) {
92+ func GetNonSystemTableNames (ctx context.Context , root RootValue , isSystemTableFn func ( n string ) bool ) ([]string , error ) {
9493 tn , err := root .GetTableNames (ctx , DefaultSchemaName )
9594 if err != nil {
9695 return nil , err
9796 }
9897 tn = funcitr .FilterStrings (tn , func (n string ) bool {
99- return ! HasDoltPrefix (n )
98+ return ! isSystemTableFn (n )
10099 })
101100 sort .Strings (tn )
102101 return tn , nil
103102}
104103
105104// GetSystemTableNames gets system table names
106- func GetSystemTableNames (ctx context.Context , root RootValue ) ([]string , error ) {
107- p , err := GetPersistedSystemTables (ctx , root )
105+ func GetSystemTableNames (ctx context.Context , root RootValue , isSystemTableFn func ( n string ) bool ) ([]string , error ) {
106+ p , err := GetPersistedSystemTables (ctx , root , isSystemTableFn )
108107 if err != nil {
109108 return nil , err
110109 }
@@ -121,13 +120,13 @@ func GetSystemTableNames(ctx context.Context, root RootValue) ([]string, error)
121120}
122121
123122// GetPersistedSystemTables returns table names of all persisted system tables.
124- func GetPersistedSystemTables (ctx context.Context , root RootValue ) ([]string , error ) {
123+ func GetPersistedSystemTables (ctx context.Context , root RootValue , isSystemTableFn func ( n string ) bool ) ([]string , error ) {
125124 tn , err := root .GetTableNames (ctx , DefaultSchemaName )
126125 if err != nil {
127126 return nil , err
128127 }
129128 sort .Strings (tn )
130- return funcitr .FilterStrings (tn , HasDoltPrefix ), nil
129+ return funcitr .FilterStrings (tn , isSystemTableFn ), nil
131130}
132131
133132// GetGeneratedSystemTables returns table names of all generated system tables.
@@ -153,7 +152,7 @@ var getWriteableSystemTables = func() []string {
153152 return []string {
154153 GetDocTableName (),
155154 DoltQueryCatalogTableName ,
156- SchemasTableName ,
155+ GetSchemasTableName () ,
157156 GetProceduresTableName (),
158157 IgnoreTableName ,
159158 RebaseTableName ,
0 commit comments