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