psql
PostgreSQL is an advanced open-source RDBMS, increasingly used by an increasingly large number of high profile projects. We use it in CS 4604 because:
a) it is open-source and free ("free as in speech, not as in beer") software;
b) it is not really important which RDBMS you use to learn SQL;
c) among open-source RDBMS, PostgreSQL has some advantages over MySQL
(e.g., MySQL does not enforce CHECK
constraints).
Extensive documentation is available for PostgreSQL, which you should make for your leisure reading. The documentation is also available with user comments.
Yes! You are welcome to do your project on your own computer, as long as I can evaluate the final step of your project. Install version 8.4 or later. PostgreSQL works on Linux and Windows. You can download versions for these operating systems. For Mac OS X, please use the fink system.
Follow the following steps to use the CS 4604 PostgreSQL server. Some of the steps below apply only the first time you log in. Note: Do NOT wait till the assignment due dates to test it out!
ssh
to rlogin.cs.vt.edu
using your SLO account.
psql -h cs4604.cs.vt.edu -U "user name" -d "database name"
(the psql shell will prompt you for
the password).
Use your SLO username as the username. Email Qianzhou for the default password (also posted on Piazza now). If you provide the correct username and password, you
will get a psql
prompt where you can type in SQL commands and
queries.
psql
prompt:
alter user <username> password 'YourNewPassword';
psql
prompt, type \d
to show a list of databases that you have
access to. One of these two databases is for the project group. All
the members of your project have the right to access to this
database. This database is named after your project title or group
title. The name of the other is the same as your username; only you
can access this database.
If you do not find the group database, please send Qianzhou email to let him know which project group you belong to, the name of the project, and the members of your group. He will give you access to the right database.
psql
You will often use the psql
command line client to talk
to the CS 4604 server, especially for Project assignments 2 and 6. Here
are some potentially useful tips.
copy
command. Read the documentation
for this command, which is about a third of the way down the web page.
CHECK
constraints. Nor does it allow the constraint to refer to variables
other than columns of the current row. This sad fact is documented
(search for the third occurrence of "CHECK (expression)"). select pg_size_pretty(pg_relation_size('table_name'));
select pg_size_pretty(pg_database_size('database_name'));