![]() ![]() (4 rows) Redshift SET ON_ERROR_STOP using psql -v Option $ psql -v ON_ERROR_STOP=ON -f 'sample_sql. Psql:sample_sql.sql:5: ERROR: relation "pat_23" does not exist Psql will continue after displaying error: $ psql -f 'sample_sql.sql' If you execute script without setting variable. Psql:sample_sql.sql:6: ERROR: relation "pat_23" does not exist Lets execute the sql file using psql and see how Redshift behaves: Select * from PAT_2 - This table is does not exists in the database so psql will stop execution at this poin and gives error Let’s check how ON_ERRO_STOP with an examples. The success or failure of the commands inside the block determine the exit value. \unset section are ignored when there is an ON_ERROR_STOP block. This table is does not exists in the database so psql will stop execution at this poin and gives error If you create an ON_ERROR_STOP block inside a query file, as in this example: \set ON_ERROR_STOP on Something similar happens to sound waves when a source of sound moves relative to an observer. The term can be understood literally - the wavelength of the light is stretched, so the light is seen as 'shifted' towards the red part of the spectrum. ![]() If you want the psql to stop and exit when it encounters an error with a query, include -v ON_ERROR_STOP=ON on the command line or set ON_ERROR_STOP variable inside the sql query that you are going to run. 'Red shift' is a key concept for astronomers. ![]() Psql command with option -f executes all sql statements in the given file. 3: if an error occurred in a script and the system variable ON_ERROR_STOP was set.2: if the connection to the server failed and the session was not interactive.1: if a fatal error of its own occurs (e.g.0: to the shell if it finished sql execution normally.Psql returns following EXIT status when you are executing Redshfit SQL from files: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |