Скачать в pdf «PostgreSQL»

Check your locale configuration. PostgreSQL uses the locale setting of the user that ran the postmaster process. There are postgres and psql SET commands to control the date format. Set those accordingly for your operating environment.

4.2)    What is the exact difference between binary cursors and normal cursors?

See the DECLARE manual page for a description.

4.3)    How do I select only the first few rows of a query?

See the FETCH manual page, or use SELECT…LIMIT….

The entire query may have to be evaluated, even if you only want the first few rows. Consider a query that has an ORDER BY. If there is an index that matches the ORDER BY, PostgreSQL may be able to evaluate only the first few records requested, or the entire query may have to be evaluated until the desired rows have been generated.

4.4)    How do I get a list of tables or other information I see inpsql?

You can read the source code for psql in file pgsql/src/bin/psqllpsql.c. It contains SQL commands that generate the output for psql’s backslash commands. You can also start psql with the -E option so it will print out the queries it uses to execute the commands you give.

4.5)    How do you remove a column from a table?

We do not support alter table drop column, but do this:

SELECT … — select all columns but the one you want to remove INTO TABLE new_table FROM old_table;

DROP TABLE old_table;

Скачать в pdf «PostgreSQL»