File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -880,6 +880,30 @@ t('Connection errors are caught using begin()', {
880
880
]
881
881
} )
882
882
883
+ t ( 'dynamic table name' , async ( ) => {
884
+ await sql `create table test(a int)`
885
+ return [
886
+ 0 , ( await sql `select * from ${ sql ( 'test' ) } ` ) . count ,
887
+ await sql `drop table test`
888
+ ]
889
+ } )
890
+
891
+ t ( 'dynamic schema name' , async ( ) => {
892
+ await sql `create table test(a int)`
893
+ return [
894
+ 0 , ( await sql `select * from ${ sql ( 'public' ) } .test` ) . count ,
895
+ await sql `drop table test`
896
+ ]
897
+ } )
898
+
899
+ t ( 'dynamic schema and table name' , async ( ) => {
900
+ await sql `create table test(a int)`
901
+ return [
902
+ 0 , ( await sql `select * from ${ sql ( 'public.test' ) } ` ) . count ,
903
+ await sql `drop table test`
904
+ ]
905
+ } )
906
+
883
907
t ( 'dynamic column name' , async ( ) => {
884
908
return [ '!not_valid' , Object . keys ( ( await sql `select 1 as ${ sql ( '!not_valid' ) } ` ) [ 0 ] ) [ 0 ] ]
885
909
} )
You can’t perform that action at this time.
0 commit comments