I have following two tables:-
postgres=# select * from district; id | name ----+----------- 1 | Ahmedabad 2 | Barmer (2 rows) postgres=# select * from wa
try:
insert into warehouse (name, district_id) select 'Ghodasar-WH',id from district where name = 'Ahmedabad';
https://www.postgresql.org/docs/current/static/sql-insert.html
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
so just use query here
query