![]() This is equivalent to setting the variable ECHO_HIDDEN to on. You can use this to study psql's internal operations. EĮcho the actual queries generated by \d and other backslash commands. This is equivalent to setting the variable ECHO to queries. eĬopy all SQL commands sent to the server to standard output as well. If so, connection string parameters will override any conflicting command line options. This is equivalent to specifying dbname as the first non-option argument on the command line. Specifies the name of the database to connect to. It's better to feed multiple commands to psql's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF ![]() Also, only the result of the last SQL command is returned.īecause of these legacy behaviors, putting more than one command in the -c string often has unexpected results. This is different from the behavior when the same string is fed to psql's standard input. ![]() If the command string contains multiple SQL commands, they are processed in a single transaction, unless there are explicit BEGIN/ COMMIT commands included in the string to divide it into multiple transactions. To achieve that, you could pipe the string into psql, for example: echo '\x \\ SELECT * FROM foo ' | psql. Thus you cannot mix SQL and psql meta-commands with this option. Start-up files ( psqlrc and ~/.psqlrc) are ignored with this option.Ĭommand must be either a command string that is completely parsable by the server (i.e., it contains no psql-specific features), or a single backslash command. Specifies that psql is to execute one command string, command, and then exit. This is equivalent to setting the variable ECHO to errors. Print failed SQL commands to standard error output. (The default output mode is otherwise aligned.) -b (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all. Write * to return all columns.Print all nonempty input lines to standard output as they are read. The expression can use any column names of the table named by table_name or table(s) listed in USING. output_expressionĪn expression to be computed and returned by the DELETE command after each row is deleted. See DECLARE for more information about using cursors with WHERE CURRENT OF. Note that WHERE CURRENT OF cannot be specified together with a Boolean condition. The cursor must be a non-grouping query on the DELETE's target table. The row to be deleted is the one most recently fetched from this cursor. The name of the cursor to use in a WHERE CURRENT OF condition. Only rows for which this expression returns true will be deleted. conditionĪn expression that returns a value of type boolean. Do not repeat the target table as a from_item unless you wish to set up a self-join (in which case it must appear with an alias in the from_item). This uses the same syntax as the FROM clause of a SELECT statement for example, an alias for the table name can be specified. from_itemĪ table expression allowing columns from other tables to appear in the WHERE condition. For example, given DELETE FROM foo AS f, the remainder of the DELETE statement must refer to this table as f not foo. When an alias is provided, it completely hides the actual name of the table. aliasĪ substitute name for the target table. ![]() Optionally, * can be specified after the table name to explicitly indicate that descendant tables are included. If ONLY is not specified, matching rows are also deleted from any tables inheriting from the named table. If ONLY is specified before the table name, matching rows are deleted from the named table only. The name (optionally schema-qualified) of the table to delete rows from. The WITH clause allows you to specify one or more subqueries that can be referenced by name in the DELETE query.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |