GithubHelp home page GithubHelp logo

postgresguide.com's People

Contributors

andrewstuart avatar craigkerstiens avatar galenandrew avatar gidoca avatar ivuk avatar jcoleman avatar julienp avatar kanet77 avatar madusudanan avatar mattgraham avatar mattrobenolt avatar mbiette avatar michrome avatar morenoh149 avatar rdmurphy avatar sethwoodworth avatar sirodoht avatar smnplk avatar vishalsodani 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

postgresguide.com's Issues

Please add a good license

Currently there is no license so copyright belongs to you @craigkerstiens.

I suggest you to use a good creative commons license with not much restrictions for the text itself.
http://creativecommons.org/choose/

E.g. it would be also great to use this guide internally in a company.

Currently I'm not willing to contribute because of 1. a missing and 2. a free open license.

Another advice:
Also adopt the license for the software / the template you are using.

Please add the example.dump to the repo

hi
the command curl http://cl.ly/173L141n3402/download/example.dump does not work on OS X 10.11, it downloads a zero KB file.
But opening the file directly in the browser works. Please add it to the repo.

regards

Unclear

The following excerpt in _performance/001-Indexes.md is unclear:

### When your index is smarter than you

In all cases an index will not be be used by Postgres. ...

The "be be" appears to be a minor error of accidental duplication.

That aside, I still don't understand the intent of this sentence. Is it meant to convey, "It is not always fastest for Postgres to make use of an index."?

Translation to Brazilian Portuguese

hi there,

Do you have any interest in translate this guide to brazilian portuguese?

I can translate the markdown files if you have some interest.

Or perhaps can you authorize to make a translated book using the gitbook platform?

Thanks.

Change filenames of markdown files

Error reading file ..... Document '_setup/001-install.md' does not have a valid date in the YAML front matter.

Instead of having 001-install.md we can have it as 2015-11-19-install.md.

  • We can eliminate the nasty issues popping in jekyll console.
  • We can have the last updated date listed in the page itself, might be helpful for users.

This also opens up many possibilities, but I don't feel having 001 in the file name helpful in any way.

I can send a pull request if I know the dates of the published articles.

Publish each release as a PDF?

The use case is that I'm a kindle user, and would prefer an "official" PDF, rather than having to roll my own. And yea it's OK that the PDF gets stale, since it would be very easy to get the latest version.

\d meta-command returns 8 rows, not 3, on my psql

I'm happy to fix in a PR but want to be sure I'm not making a mistake first. Am new to postgres from mysql.

On http://postgresguide.com/sql/select.html when you do a \d the guide shows 3 rows (as 3 tables).

When I run \d I get 8 rows consisting of 4 tables and 4 sequences:
List of relations
Schema | Name | Type | Owner
--------+-----------------------+----------+--------
public | products | table | tmowad
public | products_id_seq | sequence | tmowad
public | purchase_items | table | tmowad
public | purchase_items_id_seq | sequence | tmowad
public | purchases | table | tmowad
public | purchases_id_seq | sequence | tmowad
public | users | table | tmowad
public | users_id_seq | sequence | tmowad

I'm a bit confused since on the prior page, it was clearly shown that there are 4 tables (which match up to mine).

Even when I do \dt (for tables only), I get 4 tables, not the 3 in the guide.

Is this clearly a mistake that I can fix in a PR? Did some postgres version change cause this or what?

Example pg_restore commands didn't work for me

I like your postgresguide.com! Good work.

When following instructions on http://postgresguide.com/setup/example.html to install local example database, the pg_restore command ran, but I don't see the tables created. I have to end up first create a database, then specify that as option to get it work.


bash> curl -L -O http://cl.ly/173L141n3402/download/example.dump
bash> createdb pgguide
bash> pg_restore --no-owner --dbname pgguide example.dump
bash> psql --dbname pgguide

pgguide=# \dt
            List of relations
 Schema |      Name      | Type  | Owner  
--------+----------------+-------+--------
 public | products       | table | zemian
 public | purchase_items | table | zemian
 public | purchases      | table | zemian
 public | users          | table | zemian

Postgresql app development

Hi.

I think the Postgres guide is a great idea. I am just starting to use Postgres for web apps. I have been using it mostly through Django ORM, but it would be good to know your database well. Especially since Postgres is really an application platform on top of a database, with its support for languages other than SQL and interface for external dbs etc. And relational model is only one of the available data models.

I have tried searching about this, but mostly in vain. I'd like to see the Postgres Guide explain how to put up a development workflow with source code management, testing, deployment and so on. What tools are there to interact with the database for changing schema, editing different types of code with syntax highlight. Everything should be in version control.

I have the Posgres administration cookbook and high performance book, but neither really talk about development. Articles I have found mostly speak about SQL coding in general.

I read Craig Kerstiens' blog posts about notable Postgres features, most of which I knew nothing about. I have use cases for them, like access to Redis and listen/notify. What I lack is knowledge on how to develop with Postgres. Right now it seems the only approach is to use Pgadmin3 as an IDE (which keeps crashing) or the psql cli. Since my knowledge on this is severely limited, I can't yet contribute to the guide all that much.

tl:dr; I'd like to know what is the Postgres way of app development, what are the best practises and tools.

Index cache hit rate SQL is incorrect

SELECT
sum(idx_blks_read) as idx_read,
sum(idx_blks_hit) as idx_hit,
sum(idx_blks_hit) - sum(idx_blks_read)) sum(idx_blks_hit) as ratio
FROM
pg_statio_user_indexes;

pg_store with example.dump failed

I have installed pg with docker locally, and I can access it successfully. I have created the user craig ,database pgguide。However, when I restore the dump file as sub command, I encounter with a error。

 $ pg_restore --no-owner -h localhost --dbname pgguide example.dump
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2251; 0 0 COMMENT EXTENSION plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of extension plpgsql
    Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';



pg_restore: [archiver (db)] Error from TOC entry 2252; 0 0 COMMENT EXTENSION hstore
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of extension hstore
    Command was: COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';



pg_restore: [archiver (db)] Error from TOC entry 166; 1259 444692 TABLE products craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "products" already exists
    Command was: CREATE TABLE products (
    id integer NOT NULL,
    title character varying(255),
    price numeric,
    created_at timesta...
pg_restore: [archiver (db)] Error from TOC entry 165; 1259 444690 SEQUENCE products_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "products_id_seq" already exists
    Command was: CREATE SEQUENCE products_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2253; 0 0 SEQUENCE OWNED BY products_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation products_id_seq
    Command was: ALTER SEQUENCE products_id_seq OWNED BY products.id;



pg_restore: [archiver (db)] Error from TOC entry 2254; 0 0 SEQUENCE SET products_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence products_id_seq
    Command was: SELECT pg_catalog.setval('products_id_seq', 20, true);



pg_restore: [archiver (db)] Error from TOC entry 168; 1259 444703 TABLE purchase_items craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchase_items" already exists
    Command was: CREATE TABLE purchase_items (
    id integer NOT NULL,
    purchase_id integer,
    product_id integer,
    price numeric,
 ...
pg_restore: [archiver (db)] Error from TOC entry 167; 1259 444701 SEQUENCE purchase_items_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchase_items_id_seq" already exists
    Command was: CREATE SEQUENCE purchase_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2255; 0 0 SEQUENCE OWNED BY purchase_items_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items_id_seq
    Command was: ALTER SEQUENCE purchase_items_id_seq OWNED BY purchase_items.id;



pg_restore: [archiver (db)] Error from TOC entry 2256; 0 0 SEQUENCE SET purchase_items_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence purchase_items_id_seq
    Command was: SELECT pg_catalog.setval('purchase_items_id_seq', 1458, true);



pg_restore: [archiver (db)] Error from TOC entry 162; 1259 444669 TABLE purchases craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchases" already exists
    Command was: CREATE TABLE purchases (
    id integer NOT NULL,
    created_at timestamp with time zone,
    name character varying(255),
...
pg_restore: [archiver (db)] Error from TOC entry 161; 1259 444667 SEQUENCE purchases_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "purchases_id_seq" already exists
    Command was: CREATE SEQUENCE purchases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2257; 0 0 SEQUENCE OWNED BY purchases_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases_id_seq
    Command was: ALTER SEQUENCE purchases_id_seq OWNED BY purchases.id;



pg_restore: [archiver (db)] Error from TOC entry 2258; 0 0 SEQUENCE SET purchases_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence purchases_id_seq
    Command was: SELECT pg_catalog.setval('purchases_id_seq', 1000, true);



pg_restore: [archiver (db)] Error from TOC entry 164; 1259 444680 TABLE users craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "users" already exists
    Command was: CREATE TABLE users (
    id integer NOT NULL,
    email character varying(255),
    password character varying(255),
    det...
pg_restore: [archiver (db)] Error from TOC entry 163; 1259 444678 SEQUENCE users_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "users_id_seq" already exists
    Command was: CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;



pg_restore: [archiver (db)] Error from TOC entry 2259; 0 0 SEQUENCE OWNED BY users_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation users_id_seq
    Command was: ALTER SEQUENCE users_id_seq OWNED BY users.id;



pg_restore: [archiver (db)] Error from TOC entry 2260; 0 0 SEQUENCE SET users_id_seq craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for sequence users_id_seq
    Command was: SELECT pg_catalog.setval('users_id_seq', 50, true);



pg_restore: [archiver (db)] Error from TOC entry 2232; 2604 444695 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation products
    Command was: ALTER TABLE ONLY products ALTER COLUMN id SET DEFAULT nextval('products_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2233; 2604 444706 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items
    Command was: ALTER TABLE ONLY purchase_items ALTER COLUMN id SET DEFAULT nextval('purchase_items_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2230; 2604 444672 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases
    Command was: ALTER TABLE ONLY purchases ALTER COLUMN id SET DEFAULT nextval('purchases_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2231; 2604 444683 DEFAULT id craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation users
    Command was: ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);



pg_restore: [archiver (db)] Error from TOC entry 2245; 0 444692 TABLE DATA products craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation products
    Command was: COPY products (id, title, price, created_at, deleted_at, tags) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2246; 0 444703 TABLE DATA purchase_items craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation purchase_items
    Command was: COPY purchase_items (id, purchase_id, product_id, price, quantity, state) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2243; 0 444669 TABLE DATA purchases craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation purchases
    Command was: COPY purchases (id, created_at, name, address, state, zipcode, user_id) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2244; 0 444680 TABLE DATA users craig
pg_restore: [archiver (db)] could not execute query: ERROR:  permission denied for relation users
    Command was: COPY users (id, email, password, details, created_at, deleted_at) FROM stdin;

pg_restore: [archiver (db)] Error from TOC entry 2239; 2606 444700 CONSTRAINT products_pkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation products
    Command was: ALTER TABLE ONLY products
    ADD CONSTRAINT products_pkey PRIMARY KEY (id);



pg_restore: [archiver (db)] Error from TOC entry 2235; 2606 444677 CONSTRAINT purchases_pkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases
    Command was: ALTER TABLE ONLY purchases
    ADD CONSTRAINT purchases_pkey PRIMARY KEY (id);



pg_restore: [archiver (db)] Error from TOC entry 2237; 2606 444688 CONSTRAINT users_pkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation users
    Command was: ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);



pg_restore: [archiver (db)] Error from TOC entry 2242; 2606 444715 FK CONSTRAINT purchase_items_product_id_fkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items
    Command was: ALTER TABLE ONLY purchase_items
    ADD CONSTRAINT purchase_items_product_id_fkey FOREIGN KEY (product_id) REFERENCES produc...
pg_restore: [archiver (db)] Error from TOC entry 2241; 2606 444710 FK CONSTRAINT purchase_items_purchase_id_fkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchase_items
    Command was: ALTER TABLE ONLY purchase_items
    ADD CONSTRAINT purchase_items_purchase_id_fkey FOREIGN KEY (purchase_id) REFERENCES purc...
pg_restore: [archiver (db)] Error from TOC entry 2240; 2606 444720 FK CONSTRAINT purchases_user_id_fkey craig
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner of relation purchases
    Command was: ALTER TABLE ONLY purchases
    ADD CONSTRAINT purchases_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);



WARNING: errors ignored on restore: 32

Is the dump file not latest or I did with a wrong way? beg for ur answer.

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.