Check out example codes for "psql commande \gset". It will help you in understanding the concepts better.
Code Example 1
=> SELECT 'hello' AS var1, 10 AS var2
-> \gset result_
=> \echo :result_var1 :result_var2
hello 10
Code Example 2
=> SELECT 'hello' AS var1, 10 AS var2
-> \gset
=> \echo :var1 :var2
hello 10
Learn ReactJs, React Native from akashmittal.com