1. git clone

(FRUM) [alexlai@n2MnJaro sample]$ pwd
/opt/home/alexlai/postgresql-proj/sample

$ git clone https://github.com/xzilla/pagila.git
  1. INSTALLATION

To install the pagila database, first create an empty database named pagila, and then feed in the schema file, followed by the data file. Using psql that would look like this:

psql -c "CREATE DATABASE pagila;"
psql -d pagila -f pagila-schema.sql
psql -d pagila -f pagila-data.sql

The pagila-data.sql file and the pagila-insert-data.sql both contain the same data, the former using COPY commands, the latter using INSERT commands, so you only need to install one of them. Both formats are provided for those who have trouble using one version or another.

[alexlai@n2MnJaro pagila]$ pwd
/opt/home/alexlai/postgresql-proj/sample/pagila
[alexlai@n2MnJaro pagila]$ ls
pagila-data.sql  pagila-insert-data.sql  pagila-schema.sql  README

[alexlai@n2MnJaro pagila]$ psql -U postgres
postgres=# CREATE DATABASE pagila;
CREATE DATABASE
postgres=# \q

[alexlai@n2MnJaro pagila]$ psql -U postgres -d pagila -f pagila-schema.sql

[alexlai@n2MnJaro pagila]$ psql -U postgres -d pagila -f pagila-data.sql
  1. Verify
[alexlai@n2MnJaro pagila]$ psql -U postgres -d pagila

pagila=# SELECT *  FROM customer LIMIT 5;
 customer_id | store_id | first_name | last_name |                email                | address_id | activebool | create_date |     last_update     | active 
-------------+----------+------------+-----------+-------------------------------------+------------+------------+-------------+---------------------+--------
           1 |        1 | MARY       | SMITH     | MARY.SMITH@sakilacustomer.org       |          5 | t          | 2006-02-14  | 2006-02-15 09:57:20 |      1
           2 |        1 | PATRICIA   | JOHNSON   | PATRICIA.JOHNSON@sakilacustomer.org |          6 | t          | 2006-02-14  | 2006-02-15 09:57:20 |      1
           3 |        1 | LINDA      | WILLIAMS  | LINDA.WILLIAMS@sakilacustomer.org   |          7 | f          | 2006-02-14  | 2006-02-15 09:57:20 |      0
           4 |        2 | BARBARA    | JONES     | BARBARA.JONES@sakilacustomer.org    |          8 | t          | 2006-02-14  | 2006-02-15 09:57:20 |      1
           5 |        1 | ELIZABETH  | BROWN     | ELIZABETH.BROWN@sakilacustomer.org  |          9 | t          | 2006-02-14  | 2006-02-15 09:57:20 |      1
(5 rows)

[alexlai@n2MnJaro pagila]$ psql -c "CREATE DATABASE pagila;"
CREATE DATABASE
[alexlai@n2MnJaro pagila]$ psql -d pagila -f pagila-schema.sql
SET
SET
SET
SET
SET
 set_config 
------------
 
(1 row)

SET
SET
SET
SET
CREATE SCHEMA
psql:pagila-schema.sql:26: ERROR:  must be member of role "postgres"
CREATE TYPE
psql:pagila-schema.sql:41: ERROR:  must be member of role "postgres"
CREATE DOMAIN
psql:pagila-schema.sql:51: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:68: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:85: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:102: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:147: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:169: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:206: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:224: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:239: ERROR:  must be member of role "postgres"
CREATE FUNCTION
psql:pagila-schema.sql:269: ERROR:  must be member of role "postgres"
CREATE PROCEDURE
psql:pagila-schema.sql:337: ERROR:  must be member of role "postgres"
CREATE AGGREGATE
psql:pagila-schema.sql:349: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:363: ERROR:  must be member of role "postgres"
SET
SET
CREATE TABLE
psql:pagila-schema.sql:383: ERROR:  must be member of role "postgres"
CREATE VIEW
psql:pagila-schema.sql:400: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:414: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:428: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:442: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:455: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:469: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:494: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:507: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:520: ERROR:  must be member of role "postgres"
CREATE VIEW
psql:pagila-schema.sql:543: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:557: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:575: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:589: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:603: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:617: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:630: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:644: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:668: ERROR:  must be member of role "postgres"
CREATE VIEW
psql:pagila-schema.sql:693: ERROR:  must be member of role "postgres"
CREATE VIEW
psql:pagila-schema.sql:716: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:730: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:744: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:758: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:771: ERROR:  must be member of role "postgres"
CREATE MATERIALIZED VIEW
psql:pagila-schema.sql:795: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:809: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:826: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:842: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:858: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:874: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:890: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:906: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:922: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:938: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:954: ERROR:  must be member of role "postgres"
CREATE VIEW
psql:pagila-schema.sql:965: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:979: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:1000: ERROR:  must be member of role "postgres"
CREATE VIEW
psql:pagila-schema.sql:1021: ERROR:  must be member of role "postgres"
CREATE SEQUENCE
psql:pagila-schema.sql:1035: ERROR:  must be member of role "postgres"
CREATE TABLE
psql:pagila-schema.sql:1049: ERROR:  must be member of role "postgres"
ALTER TABLE
....
ALTER INDEXq