Sample schemas and data that correlate with all examples in PostgreSQL documentation

From: Minh Van Le <mvanle(at)tpg(dot)com(dot)au>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Sample schemas and data that correlate with all examples in PostgreSQL documentation
Date: 2022-12-26 11:03:48
Message-ID: bc6873bf572185641fa4468daf1d8766432b71a4.camel@tpg.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would like to follow through and experiment with the examples in the
PostgreSQL documentation but find it difficult to compare impacts of
commands without actual working data.

Is there sample data or a default database that correlates with all the
examples in the PostgreSQL documentation ?

Problem
-------

Getting table or column "does not exist" errors when executing SQL in
documentation eg
(https://www.postgresql.org/docs/10/tutorial-window.html)

SELECT depname, empno, salary, enroll_date
FROM
(SELECT depname, empno, salary, enroll_date, rank() OVER (PARTITION
BY depname ORDER BY salary DESC, empno) AS pos
FROM empsalary
) AS ss
WHERE pos < 3;

Error
-----

SQL Error [42703]: ERROR: column "enroll_date" does not exist

Attempted workarounds
---------------------

* Stack Builder does not list sample data installation options

* The sources do not contain required sample data (eg. "src\tutorial"
directory et al in
https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.gz)

* Any 3rd-party sample data found appear incomplete or non-official
(eg. "advanced-psql-examples.sql" from
https://gist.github.com/marko-asplund/5561404 missing "enroll_date"
column)

Versions
--------

* PostgreSQL 10.23
(https://web3.pioneersoftware.co.uk/files/pgsql/10/postgresql-10.23-1-windows.exe
)

* Stack Builder 4.2.1

Addendum
--------

I found DDL and data for empsalary in "src\test\regress\sql\window.sql"
but there are other tables mentioned in the documentation that I cannot
find accompanying the sources (eg. regional_sales, top_regions,
included_parts etc) (ref: postgresql.org/docs/10/queries-with.html)
And of those that do have DDL (eg. orders, products) there is only
minimal sample data (eg. 1 row) simply to satisfy a regression test.

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2022-12-26 15:54:20 Re: best practice to patch a postgresql version?
Previous Message qihua wu 2022-12-26 09:29:11 best practice to patch a postgresql version?