Git Product home page Git Product logo

postgres-showcase's Introduction

postgres-showcase

Sample object creation and query scripts to illustrate different Postgres object types and data quering possibilities. Targeted for beginners.

Rollout

For running all the scripts on a local Postgres DB (superuser assumed) use the provided rollout.sh script which consist of:

ls *.sql | sort -n | xargs -n 1 psql -f

All feedback welcome!

postgres-showcase's People

Contributors

justinclift avatar kierankaelin avatar kmoppel avatar peterneave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postgres-showcase's Issues

Extract the run command into a script.

The run command mentioned in the README should be extracted into a script so that someone can simply clone the repository and run the script, instead of copying a command.

It can also be shortened, depending on how portable one does want it. For example this is the shortest incarnation I can come up with:

ls -v *.sql | xargs psql -f

However, the -v flag of ls is not portable and is most likely only available in the GNU version...but so is the -V flag of sort, as far as I am aware. So the most portable script is most likely this one:

ls *.sql | sort -n | xargs psql -f

Add ARRAY(SELECT) example to the arrays file

SELECT ARRAY(SELECT col1 FROM ( VALUES (1), (2), (3) ) vals (v)); -- {1,2,3}

basically equivalent to SELECT (SELECT array_agg(col1) ...)

I'm not sure whether one performs better than the other but the ARRAY() form seems more natural when working in a scalar subquery context.

Suggestion: omit "domains"

I just have this impression, from vague recollection of list emails and some fading first-hand experience, that the implementation details of domains when used in casting/functions makes using them potentially problematic.

Simple way to support translations

To avoid fork for each language maybe we could add a script (like bash for Linux) which remplace all english comment to a translated one ?

Introduce SQL language "functions" first

I'd probably introduce SQL language "functions" first and describe them (and SQL generally) as being an imperative language.

Then when introducing pl/pgsql I'd highlight that it is a procedural language and should be chosen when SQL cannot solve the problem at hand - in particular since executing queries with SQL functions can be optimized moreso that queries with pl/pgsql functions.

I seem to recall "stored procedures" having a "standalone transaction context" associated with them while functions always execute within the same transaction as the caller. I'd change the name for 20_stored_procedures.sql for this reason; though I guess it depends on what the target audience is more likely to expect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.