@@ -93,48 +93,47 @@ func HasDoltCIPrefix(s string) bool {
9393
9494// IsFullTextTable returns a boolean stating whether the given table is one of the pseudo-index tables used by Full-Text
9595// indexes.
96- // TODO: Schema name
97- func IsFullTextTable (name string ) bool {
98- return HasDoltPrefix (name ) && (strings .HasSuffix (name , "_fts_config" ) ||
96+ func IsFullTextTable (name string , isSystemTable bool ) bool {
97+ return isSystemTable && (strings .HasSuffix (name , "_fts_config" ) ||
9998 strings .HasSuffix (name , "_fts_position" ) ||
10099 strings .HasSuffix (name , "_fts_doc_count" ) ||
101100 strings .HasSuffix (name , "_fts_global_count" ) ||
102101 strings .HasSuffix (name , "_fts_row_count" ))
103102}
104103
105104// IsDoltCITable returns whether the table name given is a dolt-ci table
106- func IsDoltCITable (name string ) bool {
107- return HasDoltCIPrefix (name ) && set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name )
105+ func IsDoltCITable (name string , isSystemTable bool ) bool {
106+ return HasDoltCIPrefix (name ) && set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name , isSystemTable )
108107}
109108
110109// IsReadOnlySystemTable returns whether the table name given is a system table that should not be included in command line
111110// output (e.g. dolt status) by default.
112- func IsReadOnlySystemTable (name string ) bool {
113- return HasDoltPrefix ( name ) && ! set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name )
111+ func IsReadOnlySystemTable (name string , isSystemTable bool ) bool {
112+ return isSystemTable && ! set .NewStrSet (getWriteableSystemTables ()).Contains (name ) && ! IsFullTextTable (name , isSystemTable )
114113}
115114
116115// IsNonAlterableSystemTable returns whether the table name given is a system table that cannot be dropped or altered
117116// by the user.
118- func IsNonAlterableSystemTable (name string ) bool {
119- return (IsReadOnlySystemTable (name ) && ! IsFullTextTable (name )) || strings .EqualFold (name , SchemasTableName )
117+ func IsNonAlterableSystemTable (name string , isSystemTable bool ) bool {
118+ return (IsReadOnlySystemTable (name , isSystemTable ) && ! IsFullTextTable (name , isSystemTable )) || strings .EqualFold (name , GetSchemasTableName () )
120119}
121120
122121// GetNonSystemTableNames gets non-system table names
123- func GetNonSystemTableNames (ctx context.Context , root RootValue ) ([]string , error ) {
122+ func GetNonSystemTableNames (ctx context.Context , root RootValue , isSystemTableFn func ( n string ) bool ) ([]string , error ) {
124123 tn , err := root .GetTableNames (ctx , DefaultSchemaName )
125124 if err != nil {
126125 return nil , err
127126 }
128127 tn = funcitr .FilterStrings (tn , func (n string ) bool {
129- return ! HasDoltPrefix (n ) && ! HasDoltCIPrefix (n )
128+ return ! isSystemTableFn (n ) && ! HasDoltCIPrefix (n )
130129 })
131130 sort .Strings (tn )
132131 return tn , nil
133132}
134133
135134// GetSystemTableNames gets system table names
136- func GetSystemTableNames (ctx context.Context , root RootValue ) ([]string , error ) {
137- p , err := GetPersistedSystemTables (ctx , root )
135+ func GetSystemTableNames (ctx context.Context , root RootValue , isSystemTableFn func ( n string ) bool ) ([]string , error ) {
136+ p , err := GetPersistedSystemTables (ctx , root , isSystemTableFn )
138137 if err != nil {
139138 return nil , err
140139 }
@@ -151,13 +150,13 @@ func GetSystemTableNames(ctx context.Context, root RootValue) ([]string, error)
151150}
152151
153152// GetPersistedSystemTables returns table names of all persisted system tables.
154- func GetPersistedSystemTables (ctx context.Context , root RootValue ) ([]string , error ) {
153+ func GetPersistedSystemTables (ctx context.Context , root RootValue , isSystemTableFn func ( n string ) bool ) ([]string , error ) {
155154 tn , err := root .GetTableNames (ctx , DefaultSchemaName )
156155 if err != nil {
157156 return nil , err
158157 }
159158 sort .Strings (tn )
160- return funcitr .FilterStrings (tn , HasDoltPrefix ), nil
159+ return funcitr .FilterStrings (tn , isSystemTableFn ), nil
161160}
162161
163162// GetGeneratedSystemTables returns table names of all generated system tables.
@@ -183,7 +182,7 @@ var getWriteableSystemTables = func() []string {
183182 return []string {
184183 GetDocTableName (),
185184 DoltQueryCatalogTableName ,
186- SchemasTableName ,
185+ GetSchemasTableName () ,
187186 GetProceduresTableName (),
188187 IgnoreTableName ,
189188 RebaseTableName ,
0 commit comments