Below is the command to export the result set of a select statement to a csv file with pipe delimiter
Continue readingCategory: Postgresql
PostgreSQL – Create a Read Only User
You can create a read-only user in Postgres database by following the below sequence of commands: Create user: CREATE ROLE
Continue readingPostgreSQL – Update one table from another
Below is the syntax to update columns of one table from columns of another table in Postgres database. UPDATE table1
Continue readingPostgreSQL – ERROR: permission denied for relation
You might encounter the below error while accessing a database object in Postgres database. Error : permission denied for relation
Continue readingPostgreSQL – List installed extensions
Run the below sql to list all the extensions that are currently installed in your postgres database. SELECT * FROM
Continue readingPostgreSQL – Create User
A database user is required to establish a connection to the database. At a minimum, you need to specify the
Continue readingPostgreSQL – OFFSET Clause
In Postgres, an OFFSET clause is used to skip the first ‘n’ number of rows specified by offset clause before
Continue readingPostgreSQL – Grant super user privileges
To grant super user privileges to an existing database user, login as a super user and run the below sql
Continue readingPostgreSQL – Create Function example
Example 1: Function to return the row count of a table: CREATE FUNCTION get_row_count(v_table) RETURNS int AS $$ DECLARE v_count
Continue readingPostgreSQL – Modify current_schema and search_path
Run the below select statement to view the ‘current schema’. ‘Current schema’ is the default schema for database object creation
Continue reading