@@ -1269,4 +1269,75 @@ delete from users where id$0 = 1 and active = true;
12691269 β°β΄ β 1. source
12701270 " ) ;
12711271 }
1272+
1273+ #[ test]
1274+ fn goto_select_from_table ( ) {
1275+ assert_snapshot ! ( goto( "
1276+ create table users(id int, email text);
1277+ select * from users$0;
1278+ " ) , @r"
1279+ ββΈ
1280+ 2 β create table users(id int, email text);
1281+ β βββββ 2. destination
1282+ 3 β select * from users;
1283+ β°β΄ β 1. source
1284+ " ) ;
1285+ }
1286+
1287+ #[ test]
1288+ fn goto_select_from_table_with_schema ( ) {
1289+ assert_snapshot ! ( goto( "
1290+ create table public.users(id int, email text);
1291+ select * from public.users$0;
1292+ " ) , @r"
1293+ ββΈ
1294+ 2 β create table public.users(id int, email text);
1295+ β βββββ 2. destination
1296+ 3 β select * from public.users;
1297+ β°β΄ β 1. source
1298+ " ) ;
1299+ }
1300+
1301+ #[ test]
1302+ fn goto_select_from_table_with_search_path ( ) {
1303+ assert_snapshot ! ( goto( "
1304+ set search_path to foo;
1305+ create table foo.users(id int, email text);
1306+ select * from users$0;
1307+ " ) , @r"
1308+ ββΈ
1309+ 3 β create table foo.users(id int, email text);
1310+ β βββββ 2. destination
1311+ 4 β select * from users;
1312+ β°β΄ β 1. source
1313+ " ) ;
1314+ }
1315+
1316+ #[ test]
1317+ fn goto_select_from_temp_table ( ) {
1318+ assert_snapshot ! ( goto( "
1319+ create temp table users(id int, email text);
1320+ select * from users$0;
1321+ " ) , @r"
1322+ ββΈ
1323+ 2 β create temp table users(id int, email text);
1324+ β βββββ 2. destination
1325+ 3 β select * from users;
1326+ β°β΄ β 1. source
1327+ " ) ;
1328+ }
1329+
1330+ #[ test]
1331+ fn goto_select_from_table_defined_after ( ) {
1332+ assert_snapshot ! ( goto( "
1333+ select * from users$0;
1334+ create table users(id int, email text);
1335+ " ) , @r"
1336+ ββΈ
1337+ 2 β select * from users;
1338+ β β 1. source
1339+ 3 β create table users(id int, email text);
1340+ β°β΄ βββββ 2. destination
1341+ " ) ;
1342+ }
12721343}
0 commit comments