Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [postgresql]

PostgreSQL is an open-source, relational database management system (RDBMS) available for all major platforms, including Linux, UNIX, Windows and OS X. Mention your version of Postgres when asking questions. Consider dba.stackexchange.com for questions concerning the administration or advanced features.

2513 votes
29 answers
2.9m views

How to show tables in PostgreSQL?

What's the equivalent to show tables (from MySQL) in PostgreSQL?
flybywire's user avatar
  • 270k
2195 votes
25 answers
1.5m views

PostgreSQL "DESCRIBE TABLE"

How do you perform the equivalent of Oracle's DESCRIBE TABLE in PostgreSQL with psql command?
Mr. Muskrat's user avatar
  • 23.3k
2022 votes
21 answers
1.8m views

Select first row in each GROUP BY group?

I'd like to select the first row of each set of rows grouped with a GROUP BY. Specifically, if I've got a purchases table that looks like this: SELECT * FROM purchases; My Output: id customer total ...
David Wolever's user avatar
1967 votes
7 answers
760k views

How to exit from PostgreSQL command line utility: psql

What command or short key can I use to exit the PostgreSQL command line utility psql?
App Work's user avatar
  • 22k
1891 votes
31 answers
2.8m views

How can I change a PostgreSQL user password?

How do I change the password for a PostgreSQL user?
Saad's user avatar
  • 27.9k
1654 votes
34 answers
1.4m views

How can I drop all the tables in a PostgreSQL database?

How can I drop all tables in PostgreSQL, working from the command line? I don't want to drop the database itself, just all tables and all the data in them.
AP257's user avatar
  • 92.7k
1542 votes
16 answers
1.2m views

How to switch databases in psql?

In MySQL, I used use database_name; What's the psql equivalent?
Blankman's user avatar
  • 265k
1363 votes
24 answers
1.1m views

Which version of PostgreSQL am I running?

I'm in a corporate environment (running Debian Linux) and didn't install it myself. I access the databases using Navicat or phpPgAdmin (if that helps). I also don't have shell access to the server ...
Highly Irregular's user avatar
1216 votes
28 answers
1.2m views

Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails

I'm getting the error: FATAL: Peer authentication failed for user "postgres" when I try to make postgres work with Rails. Here's my pg_hba.conf, my database.yml, and a dump of the full trace. I ...
orderof1's user avatar
  • 12.5k
1187 votes
38 answers
1.3m views

How can I start PostgreSQL server on Mac OS X?

Final update: I had forgotten to run the initdb command. By running this command ps auxwww | grep postgres I see that postgres is not running > ps auxwww | grep postgres remcat 1789 0....
1127 votes
21 answers
956k views

Save PL/pgSQL output from PostgreSQL to a CSV file

What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file? I'm using PostgreSQL 8.4 with pgAdmin III and PSQL plugin where I run queries from.
Hoff's user avatar
  • 39.4k
1079 votes
18 answers
1.4m views

PostgreSQL error: Fatal: role "username" does not exist

I'm setting up my PostgreSQL 9.1. I can't do anything with PostgreSQL: can't createdb, can't createuser; all operations return the error message Fatal: role h9uest does not exist h9uest is my ...
h9uest's user avatar
  • 11.4k
1031 votes
13 answers
596k views

Difference between text and varchar (character varying)

What's the difference between the text data type and the character varying (varchar) data types? According to the documentation If character varying is used without length specifier, the type ...
Adam Matan's user avatar
  • 134k
1020 votes
25 answers
658k views

psql: FATAL: database "<user>" does not exist

I'm using Postgres.app for Mac. I've used it in the past on other machines but it's giving me some trouble when installing on my MacBook. I've installed the application and I ran: psql -h localhost ...
Ryan Rich's user avatar
  • 12k
992 votes
51 answers
437k views

Can't find the 'libpq-fe.h header when trying to install pg gem

I am using the Ruby on Rails 3.1 pre version. I like to use PostgreSQL, but the problem is installing the pg gem. It gives me the following error: $ gem install pg Building native extensions. This ...
demonchand's user avatar
  • 11.4k

15 30 50 per page
1
2 3 4 5
11843