I'm aware about psql -v var=value -f script.sql format as well as \set var value from within psql

What I need is dynamic variable creation while being within psql session via \i script.sql command

I.e. after call sql> \i script.sql param1 param2 from inside psql to get access to passed arguments via some automatically created variables

In Oracle such feature is present. Call to sql> @script.sql param1 param2 from sqlplus gives you access to &1 and &2 substitution variables which will hold param1 and param2 values respectively

From what I see, such behavior is not available in psql. Or it does somehow?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.