Load and Edit Database View Code in YSQLSH

We learned in a previous tip how we can from within the YSQLSH CLI use the \ef metacommand to open the code for a function or procedure into the default editor.

We can do the same with database views using the \ev metacommand!

Example:

We have the following table of data…

				
					yugabyte=# SELECT * FROM t ORDER BY c1;
 c1 | c2
----+----
 A  | A
 B  | B
 a  | a
 b  | b
(4 rows)
				
			

We want to create a view that will only return the rows from the table T where the data in column C1 are all upper case letters (US English).

Our first attempt at creating the view uses a regular expression. But then we decided to change the view to use an UPPER function after loading it into the default editor using the \ev metacommand.

Have Fun!

Elite Home Gamerooms - Mall at University Town Center - Sarasota, FL