File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -102,14 +102,16 @@ export default class Db {
102
102
if ( tableOptions . schema ) return ;
103
103
const { table, verCol, joins } = tableOptions ;
104
104
105
- const tableSchema = (
105
+ const tableInfoSchema = (
106
106
await this . query ( sqlTag `
107
- SELECT table_schema
107
+ SELECT table_schema, table_type
108
108
FROM information_schema.tables
109
109
WHERE table_name = ${ table }
110
110
ORDER BY array_position(current_schemas(false)::text[], table_schema::text) ASC
111
111
LIMIT 1` )
112
- ) . rows [ 0 ] . table_schema ;
112
+ ) . rows [ 0 ] ;
113
+ const tableSchema = tableInfoSchema . table_schema ;
114
+ const tableType = tableInfoSchema . table_type ;
113
115
114
116
const types = (
115
117
await this . query ( sqlTag `
@@ -143,7 +145,7 @@ export default class Db {
143
145
column_name = ${ verCol } ` )
144
146
) . rows [ 0 ] . column_default ;
145
147
146
- if ( ! verDefault ) {
148
+ if ( ! verDefault && tableType !== 'VIEW' ) {
147
149
throw Error ( `pg.verCol_without_default ${ verCol } ` ) ;
148
150
}
149
151
You can’t perform that action at this time.
0 commit comments