Get Mastering postgresql 15 advanced techniques to build and manage scalable reliable and fault tole
Visit to download the full and correct content document: https://textbookfull.com/product/mastering-postgresql-15-advanced-techniques-to-buil d-and-manage-scalable-reliable-and-fault-tolerant-database-applications-5th-edition-h ans-jurgen-schonig/
More products digital (pdf, epub, mobi) instant download maybe you interests ...
MASTERING JAVASCRIPT DESIGN PATTERNS create scalable and reliable applications with advanced Javascript design patterns using reliable code 3rd Edition Tomas Corral Cosas
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Reshma Raman
Publishing Product Manager: Devika Battike
Senior Editor: Nazia Shaikh
Content Development Editor: Priyanka Soam
Technical Editor: Sweety Pagaria
Copy Editor: Safis Editing
Project Coordinator: Farheen Fathima
Proofreader: Safis Editing
Indexer: Sejal Dsilva
Production Designer: Vijay Kamble
Marketing Coordinator: Nivedita Singh
First published: Jan 2018
Second edition: Oct 2018
Third edition: Nov 2019
Fourth edition: Nov 2020
Fifth published: Jan 2023
Production reference: 1270123
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-80324-834-9 www.packtpub.com
Contributors
About the author
Hans-Jürgen Schönig has 20 years’ experience with PostgreSQL. He is the CEO of a PostgreSQL consulting and support company called CYBERTEC PostgreSQL International GmbH. It has successfully served countless customers around the globe. Before founding CYBERTEC PostgreSQL International GmbH in 2000, he worked as a database developer at a private research company that focused on the Austrian labor market, where he primarily worked on data mining and forecast models. He has also written several books about PostgreSQL.
About the reviewers
Burhan Akbulut is the co-founder of PostgresTech. It is a company that provides PostgreSQL consultancy and support to start-ups and enterprise companies. Burhan Akbulut started his career as a PostgreSQL consultant at CookSoft, a well-known PostgreSQL consulting firm founded by Şahap Aşçı, where he provided consultancy and support to many international customers. Before founding PostgresTech, he worked at Vodafone as an open source database senior specialist responsible for all PostgreSQL databases. He has especially focused on database management with IaC, management of cloud databases, and migration from other databases to PostgreSQL during his career.
I would like to thank my colleague Şeyma Mintaş who helped me review the book.
Marcelo Diaz is a software engineer with more than 15 years of experience, with a special focus on PostgreSQL. He is passionate about open source software and has promoted its application in critical and high-demand environments, working as a software developer and consultant for both private and public companies. He currently works very happily at Cybertec and as a technical reviewer for Packt Publishing. He enjoys spending his leisure time with his daughter, Malvina, and his wife, Romina. He also likes playing football.
Dinesh Kumar Chemuduru works as a principal architect (OSS) at Tessell Inc. He has been working with PostgreSQL since 2011, and he also worked as a consultant at AWS. He is also an author and contributor to a few popular open source solutions. He co-authored PostgreSQL High Performance Cookbook 9.6, which was released in 2016. He loves to code in Dart, Go, Angular, and C++ and loves to deploy them in Kubernetes.
Thanks and love to my wife, Manoja Reddy, and my kids, Yashvi and Isha.
Sense of Backups and Replication
Deciding on Useful Extensions
Troubleshooting PostgreSQL
Preface
Mastering the art of handling data is an ever more important skill that is important to have. In a digital world, “data” is more or less the “new oil” – an important asset that drives the world. Every sector of IT is data-driven. It does not matter whether you are at the forefront of machine learning or whether you are working on bookkeeping software – at the end of the day, IT is all about data.
PostgreSQL has become a hot technology in the area of open source, and it is an excellent technology to store and process data in the most efficient way possible. This book will teach you how to use PostgreSQL in the most professional way and explain how to operate, optimize, and monitor this core technology, which has become so popular over the years.
By the end of the book, you will be able to use PostgreSQL to its utmost capacity by applying advanced technology and cutting-edge features.
Who this book is for
This book is ideal for PostgreSQL developers and administrators alike who want to familiarize themselves with the technology. It will provide you with deep insights and explain advanced technologies such as clustering, modern analytics, and a lot more.
Prior exposure to PostgreSQL and basic SQL knowledge is required to follow along.
What this book covers
Chapter 1, PostgreSQL 15 Overview, guides you through the most important features that have made it into the new release of PostgreSQL and explains how those features can be used.
Chapter 2, Understanding Transactions and Locking, explains the fundamental concepts of transactions and locking. Both topics are key requirements to understand storage management in PostgreSQL.
Chapter 3, Making Use of Indexes, introduces the concept of indexes, which are the key ingredient when dealing with performance in general. You will learn about simple indexes as well as more sophisticated concepts.
Chapter 4, Handling Advanced SQL, unleashes the full power of SQL and outlines the most advanced functionality a query language has to offer. You will learn about windowing functions, ordered sets, hypothetical aggregates, and a lot more. All those techniques will open a totally new world of functionality.
Chapter 5, Log Files and System Statistics, explains how you can use runtime statistics collected by PostgreSQL to make operations easier and to debug the database. You will be guided through the internal information-gathering infrastructure.
Chapter 6, Optimizing Queries for Good Performance, is all about good query performance and outlines optimization techniques that are essential to bringing your database up to speed to handle even bigger workloads.
Chapter 7, Writing Stored Procedures, introduces you to the concept of server-side code such as functions, stored procedures, and a lot more. You will learn how to write triggers and dive into server-side logic.
Chapter 8, Managing PostgreSQL Security, helps you to make your database more secure, and explains what can be done to ensure safety and data protection at all levels.
Chapter 9, Handling Backup and Recovery, helps you to make copies of your database to protect yourself against crashes and database failure.
Chapter 10, Making Sense of Backups and Replication, follows up on backups and recovery and explains additional techniques, such as streaming replication, clustering, and a lot more. It covers the most advanced topics.
Chapter 11, Deciding on Useful Extensions, explores extensions and additional useful features that can be added to PostgreSQL.
Chapter 12, Troubleshooting PostgreSQL, completes the circle of topics and explains what can be done if things don’t work as expected. You will learn how to find the most common issues and understand how problems can be fixed.
Chapter 13, Migrating to PostgreSQL, teaches you how to move your databases to PostgreSQL efficiently and quickly. It covers the most common database systems people will migrate from.
To get the most out of this book
This book has been written for a broad audience. However, some basic knowledge of SQL is necessary to follow along and make full use of the examples presented. In general, it is also a good idea to familiarize yourself with basic Unix commands as most of the book has been produced on Linux and macOS.
Software/hardware covered in the book
Pgadmin4
PostgreSQL 15
SQL Shell (psql)
Operating system requirements
Windows, macOS, or Linux
Note:
Some parts of chapters i.e., 8, 9, 10, 11,12 and 13 are mostly dedicated to unix / linux and mac users and rest runs fine on windows.
Download the example code files
You can download the example code files for this book from GitHub at https://github.com/ PacktPublishing/Mastering-PostgreSQL-15-. If there’s an update to the code, it will be updated in the GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https:// github.com/PacktPublishing/. Check them out!
Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “. You cannot run it inside a SELECT statement. Instead, you have to invoke CALL. The following listing shows the syntax of the CALL command.”
Any command-line input or output is written as follows:
# - Connection Settings –
# listen_addresses = 'localhost'
# what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Select System info from the Administration panel.”
Tips or important notes
Appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at customercare@ packtpub.com and mention the book title in the subject of your message.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Share Your Thoughts
Once you’ve read Mastering PostgreSQL 15, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback. Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.
Download a free PDF copy of this book
Thanks for purchasing this book!
Do you like to read on the go but are unable to carry your print books everywhere?
Is your eBook purchase not compatible with the device of your choice?
Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.
Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.
The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily
Follow these simple steps to get the benefits:
1. Scan the QR code or visit the link below
https://packt.link/free-ebook/9781803248349
2. Submit your proof of purchase
3. That’s it! We’ll send your free PDF and other benefits to your email directly
PostgreSQL 15 Overview
A full year has passed and the PostgreSQL community has released version 15 of the database, which includes various powerful new features that will benefit a large user base. The PostgreSQL project has also come a long way and improvements are being added constantly at a rapid pace that make the database more useful, more efficient, and more widely accepted. The times when PostgreSQL was some unknown obscure thing are long gone. PostgreSQL has reached the data center and has been widely adopted in many large companies as well as by governments around the world.
In this chapter, you will learn about new features that made it into PostgreSQL 15. Those features add additional capabilities, more performance, as well as security and enhanced usability.
The following topics are covered in this chapter:
• DBA-related features
• Developer-related features
• Performance-related features
• Additional replication features
Of course, there is always more stuff. However, let us focus on the most important changes affecting most users.
Making use of DBA-related features
In PostgreSQL 15, a couple of developer-related features were added. Some features were also finally deprecated and have been removed from the server. In this section, we will go through the most important major changes.
Removing support for old pg_dump
One of the first things that is worth noting is that support for really old databases has been removed from pg_dump. PostgreSQL databases that are older than PostgreSQL 9.2 are not supported anymore.
Considering that PostgreSQL 9.2.0 was released to the PostgreSQL community FTP server on September 10, 2012, most people should have gotten rid of their PostgreSQL 9.1 (and older) systems by now.
If you have not been able to upgrade since then, we highly recommend doing that. It is still possible to upgrade from such an old version to PostgreSQL 15. However, you will need an intermediate step and to use pg_dump twice.
Deprecating Python 2
PostgreSQL allows developers to write stored procedures in various languages. This includes Python but is not limited to it. The trouble is that Python 2.x has been deprecated for a long time already. Starting with version 15, the PostgreSQL community has also dropped support for PL/Python2U and only supports version 3 from now on.
This means that all code that is still in Python 2 should be moved to Python 3 in order to function properly.
Fixing the public schema
Up to PostgreSQL 14, the public schema that exists in every database has been available to every user. This has caused various security concerns among the user base. Basically it is easy to just use the following:
REVOKE ALL ON SCHEMA public FROM public;
This was rarely done but caused security leaks people were generally not aware of. With the introduction of PostgreSQL, the situation has changed. The public schema is, from now on, not available to the general public and you have to be granted permission to use it like before. The new behavior will make applications a lot safer and ensure that permissions are not there accidentally.
Adding pre-defined roles
In recent versions of PostgreSQL, more and more pre-defined users have been added. The core idea is to ensure that people do not have to use their superuser accounts so often. For security reasons, it is not recommended to use superusers unless explicitly needed. However, with the introduction of pre-defined roles, it is a lot easier to run things without superusers:
test=# SELECT rolname FROM pg_authid WHERE oid < 16384 AND rolname <> CURRENT_USER; rolname
pg_database_owner
pg_read_all_data
pg_write_all_data
pg_monitor
pg_read_all_settings
pg_read_all_stats
pg_stat_scan_tables
pg_read_server_files
pg_write_server_files
pg_execute_server_program
pg_signal_backend
pg_checkpointer (12 rows)
With the introduction of PostgreSQL, a new role has been added, pg_checkpointer, which allows users to manually run checkpoints if needed.
Adding permissions to variables
However, there is more. It is now possible to define permissions on variables. This was not possible before version 15. Here is an example:
GRANT SET ON PARAMETER track_functions TO hans;
This new feature allows administrators to disable bad behavior and prohibit bad parameter settings that can compromise the availability of the entire server.
Improving pg_stat_statements
Every version will also provide us with some improvements related to pg_stat_statements , which in my judgment is the key to good performance. Consider the following code snippet: test=# \d pg_stat_statements
View "public.pg_stat_statements"
Column | Type | ...
jit_functions | bigint | ...
jit_generation_time | double precision | ...
jit_inlining_count | bigint | ...
jit_inlining_time | double precision | ...
jit_optimization_count | bigint | ...
jit_optimization_time | double precision | ...
jit_emission_count | bigint | ...
jit_emission_time | double precision | ...
The module is now able to display information about the JIT compilation process and helps to detect JIT-related performance problems. Those problems are not too frequent – however, it can happen that once in a while, a JIT compilation process takes too long. This is especially true if you are running a query containing hundreds of columns.
New wait events
What is also new in PostgreSQL is a couple of wait events that give you some insights into where time is the list. The following events have been added to the system:
• ArchiveCommand
• ArchiveCleanupCommand
• RestoreCommand
• RecoveryEndCommand
Those events complement the existing wait event infrastructure and give some insights into replication-related issues.
Adding logging functionality
PostgreSQL 15 comes with a spectacular new feature: JSON logging. While JSON is comparatively large compared to the standard log format, it still comes with a couple of advantages, such as easy parsing.
Let us configure JSON logging in postgresql.conf:
log_destination = 'jsonlog' # Valid values are combinations of
# stderr, csvlog, jsonlog, syslog, and
# eventlog, depending on platform.
# csvlog and jsonlog require
# logging_collector to be on.
# This is used when logging to stderr: logging_collector = on
CET","txid":0,"error_severity":"LOG","message":"ending log output to stderr","hint":"Future log output will go to log destination \"jsonlog\".","backend_ type":"postmaster","query_id":0}
CET","txid":0,"error_severity":"LOG","message":"starting PostgreSQL 15.0 on x86_64-appledarwin21.6.0, compiled by Apple clang version 13.1.6 (clang-1316.0.21.2.5), 64bit","backend_type":"postmaster","query_id":0}
Reading a tightly packed file containing millions of JSON documents is not really user-friendly, so I recommend using a tool such as jq to make this stream more readable and user-friendly to process:
In general, it is recommended to not use JSON logs excessively as they occupy a fair amount of space.
Understanding developer-related features
Administration-related features are not everything. PostgreSQL 15 also provides some developerrelated features that are useful to build even more powerful applications. In this section, you will learn which ones are available.
Security invoker views
In PostgreSQL, a view is a separate security context. It might happen that somebody is allowed to access a view but not the underlying table. Why does this matter? Consider the following scenario:
• Joe is allowed to see all sales
• Jane is only allowed to see total turnover by country
Jane will be granted rights on a view that sums up the data. She will be able to read that view without having the right to read the sales table directly.
However, in PostgreSQL, it is now possible to make PostgreSQL treat the view more like a preprocessor directive. By setting security_invoker, it will also check the underlying tables and not treat the view as a separate security context anymore:
CREATE VIEW sample_view WITH (security_invoker=true) AS SELECT * FROM some_table WHERE id < 100;
This feature is a classic example of open source sponsoring. It has been paid for by donations to a private company.
ICU locales
ICU locales are a truly important feature of PostgreSQL. Why is this relevant? The locale determines the sort order of characters. We all take our own sort order for granted (a, b, c, … ). However, not all languages sort equally. In some languages, some characters simply show up in different sequences. For the better part of the last 35 years, the sort order used by PostgreSQL has been provided by the underlying C library (the standard OS library). The problem is that the sort order of characters can change over time. Why does this matter? Because it breaks indexing.
Remember
Indexes are basically sorted lists. The trouble is when the sort order changes, your sorted list will be wrong, which of course matters if we are talking about tables in the TB range. This is a real issue as a changing locale can result in silently corrupted indexes.
The ICU library has been designed to fix those issues and provide a stable platform for such localerelated issues. Since PostgreSQL, it is now possible to use ICU locales on the instance as well as on the database library. The following code snippet shows an example:
initdb --locale-provider=icu --icu-locale=en_US
CREATE DATABASE foo TEMPLATE template0
LOCALE_PROVIDER 'icu'
ICU_LOCALE 'fi'
It is highly recommended to make use of the ICU library to handle locales in general. It makes longterm deployments more future-proof.
Better numeric
Locales are not the only thing that has been improved. The numeric data type has also gotten a boost and some new features have been added. Consider the following code snippet:
All those features come in handy and make the data type more useful in general.
Handling ON DELETE
The ON DELETE SET NULL mechanism has been around for many decades. However, from version 15 onward, it is now possible to set only some of the NULL columns:
CREATE TABLE n_side_of_the_model (
FOREIGN KEY (col1, col2, col3)
REFERENCES one_side_of_the_er_model
ON DELETE SET NULL (col2, col3) );
This feature will greatly improve the functionality of foreign keys and make them even more useful.
Working around NULL and UNIQUE
There is also news around NULL handling. Normally, a UNIQUE constraint handles NULL values as different values. Remember: NULL means undefined and therefore we don’t know whether undefined 1 is the same as undefined 2. This constraint is not violated. Here is an example:
test=# CREATE TABLE t_null (id int UNIQUE);
CREATE TABLE
test=# INSERT INTO t_null VALUES (1);
INSERT 0 1
test=# INSERT INTO t_null VALUES (NULL); INSERT 0 1
test=# INSERT INTO t_null VALUES (NULL); INSERT 0 1
As you can see, two NULL values are perfectly fine. However, this might not be desirable. Let us drop the table and start all over:
test=# DROP TABLE t_null; DROP TABLE
New syntax has been added to handle the NULL-related behavior:
test=# CREATE TABLE t_null (id int UNIQUE NULLS NOT DISTINCT);
CREATE TABLE
test=# INSERT INTO t_null VALUES (1); INSERT 0 1
test=# INSERT INTO t_null VALUES (NULL); INSERT 0 1
test=# INSERT INTO t_null VALUES (NULL);
ERROR: duplicate key value violates unique constraint "t_null_ id_key"
DETAIL: Key (id)=(null) already exists.
As we can see, the third INSERT will error out and throw a message.
Adding the MERGE command to PostgreSQL
The MERGE command is surely one of the most important new features provided by PostgreSQL 15. It has been in the making for many years and has finally been committed to the PostgreSQL core as part of the new release.
What is the idea of MERGE? Well, INSERT … ON CONFLICT is basically “upsert” while MERGE solves a totally different problem.
How does MERGE work? Let us take a look at the syntax first:
test=# \h MERGE
Command: MERGE
Description: conditionally insert, update, or delete rows of a table
Syntax:
[ WITH with_query [, ...] ]
MERGE INTO target_table_name [ [ AS ] target_alias ] USING data_source ON join_condition when_clause [...] where data_source is: { source_table_name | ( source_query ) } [ [ AS ] source_alias ] and when_clause is: { WHEN MATCHED [ AND condition ] THEN { merge_update | merge_delete | DO NOTHING } | WHEN NOT MATCHED [ AND condition ] THEN { merge_insert | DO NOTHING } } and merge_insert is:
INSERT [( column_name [, ...] )] [ OVERRIDING { SYSTEM | USER } VALUE ]
Another random document with no related content on Scribd:
THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK
To protect the Project Gutenberg™ mission of promoting the free distribution of electronic works, by using or distributing this work (or any other work associated in any way with the phrase “Project Gutenberg”), you agree to comply with all the terms of the Full Project Gutenberg™ License available with this file or online at www.gutenberg.org/license.
Section 1. General Terms of Use and Redistributing Project Gutenberg™ electronic works
1.A. By reading or using any part of this Project Gutenberg™ electronic work, you indicate that you have read, understand, agree to and accept all the terms of this license and intellectual property (trademark/copyright) agreement. If you do not agree to abide by all the terms of this agreement, you must cease using and return or destroy all copies of Project Gutenberg™ electronic works in your possession. If you paid a fee for obtaining a copy of or access to a Project Gutenberg™ electronic work and you do not agree to be bound by the terms of this agreement, you may obtain a refund from the person or entity to whom you paid the fee as set forth in paragraph 1.E.8.
1.B. “Project Gutenberg” is a registered trademark. It may only be used on or associated in any way with an electronic work by people who agree to be bound by the terms of this agreement. There are a few things that you can do with most Project Gutenberg™ electronic works even without complying with the full terms of this agreement. See paragraph 1.C below. There are a lot of things you can do with Project Gutenberg™ electronic works if you follow the terms of this agreement and help preserve free future access to Project Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the Foundation” or PGLAF), owns a compilation copyright in the collection of Project Gutenberg™ electronic works. Nearly all the individual works in the collection are in the public domain in the United States. If an individual work is unprotected by copyright law in the United States and you are located in the United States, we do not claim a right to prevent you from copying, distributing, performing, displaying or creating derivative works based on the work as long as all references to Project Gutenberg are removed. Of course, we hope that you will support the Project Gutenberg™ mission of promoting free access to electronic works by freely sharing Project Gutenberg™ works in compliance with the terms of this agreement for keeping the Project Gutenberg™ name associated with the work. You can easily comply with the terms of this agreement by keeping this work in the same format with its attached full Project Gutenberg™ License when you share it without charge with others.
1.D. The copyright laws of the place where you are located also govern what you can do with this work. Copyright laws in most countries are in a constant state of change. If you are outside the United States, check the laws of your country in addition to the terms of this agreement before downloading, copying, displaying, performing, distributing or creating derivative works based on this work or any other Project Gutenberg™ work. The Foundation makes no representations concerning the copyright status of any work in any country other than the United States.
1.E. Unless you have removed all references to Project Gutenberg:
1.E.1. The following sentence, with active links to, or other immediate access to, the full Project Gutenberg™ License must appear prominently whenever any copy of a Project Gutenberg™ work (any work on which the phrase “Project Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook.
1.E.2. If an individual Project Gutenberg™ electronic work is derived from texts not protected by U.S. copyright law (does not contain a notice indicating that it is posted with permission of the copyright holder), the work can be copied and distributed to anyone in the United States without paying any fees or charges. If you are redistributing or providing access to a work with the phrase “Project Gutenberg” associated with or appearing on the work, you must comply either with the requirements of paragraphs 1.E.1 through 1.E.7 or obtain permission for the use of the work and the Project Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.
1.E.3. If an individual Project Gutenberg™ electronic work is posted with the permission of the copyright holder, your use and distribution must comply with both paragraphs 1.E.1 through 1.E.7 and any additional terms imposed by the copyright holder. Additional terms will be linked to the Project Gutenberg™ License for all works posted with the permission of the copyright holder found at the beginning of this work.
1.E.4. Do not unlink or detach or remove the full Project Gutenberg™ License terms from this work, or any files containing a part of this work or any other work associated with Project Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute this electronic work, or any part of this electronic work, without prominently displaying the sentence set forth in paragraph 1.E.1 with active links or immediate access to the full terms of the Project Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary, compressed, marked up, nonproprietary or proprietary form, including any word processing or hypertext form. However, if you provide access to or distribute copies of a Project Gutenberg™ work in a format other than “Plain Vanilla ASCII” or other format used in the official version posted on the official Project Gutenberg™ website (www.gutenberg.org), you must, at no additional cost, fee or expense to the user, provide a copy, a means of exporting a copy, or a means of obtaining a copy upon request, of the work in its original “Plain Vanilla ASCII” or other form. Any alternate format must include the full Project Gutenberg™ License as specified in paragraph 1.E.1.
1.E.7. Do not charge a fee for access to, viewing, displaying, performing, copying or distributing any Project Gutenberg™ works unless you comply with paragraph 1.E.8 or 1.E.9.
1.E.8. You may charge a reasonable fee for copies of or providing access to or distributing Project Gutenberg™ electronic works provided that:
• You pay a royalty fee of 20% of the gross profits you derive from the use of Project Gutenberg™ works calculated using the method you already use to calculate your applicable taxes. The fee is owed to the owner of the Project Gutenberg™ trademark, but he has agreed to donate royalties under this paragraph to the Project Gutenberg Literary Archive Foundation. Royalty payments must be paid within 60 days following each date on which you prepare (or are legally required to prepare) your periodic tax returns. Royalty payments should be clearly marked as such and sent to the Project Gutenberg Literary Archive Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive Foundation.”
• You provide a full refund of any money paid by a user who notifies you in writing (or by e-mail) within 30 days of receipt that s/he does not agree to the terms of the full Project Gutenberg™ License. You must require such a user to return or destroy all copies of the works possessed in a physical medium and discontinue all use of and all access to other copies of Project Gutenberg™ works.
• You provide, in accordance with paragraph 1.F.3, a full refund of any money paid for a work or a replacement copy, if a defect in the electronic work is discovered and reported to you within 90 days of receipt of the work.
• You comply with all other terms of this agreement for free distribution of Project Gutenberg™ works.
1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™ electronic work or group of works on different terms than are set forth in this agreement, you must obtain permission in writing from the Project Gutenberg Literary Archive Foundation, the manager of the Project Gutenberg™ trademark. Contact the Foundation as set forth in Section 3 below.
1.F.
1.F.1. Project Gutenberg volunteers and employees expend considerable effort to identify, do copyright research on, transcribe and proofread works not protected by U.S. copyright law in creating the Project Gutenberg™ collection. Despite these efforts, Project Gutenberg™ electronic works, and the medium on which they may be stored, may contain “Defects,” such as, but not limited to, incomplete, inaccurate or corrupt data, transcription errors, a copyright or other intellectual property infringement, a defective or damaged disk or other
medium, a computer virus, or computer codes that damage or cannot be read by your equipment.
1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGESExcept for the “Right of Replacement or Refund” described in paragraph 1.F.3, the Project Gutenberg Literary Archive Foundation, the owner of the Project Gutenberg™ trademark, and any other party distributing a Project Gutenberg™ electronic work under this agreement, disclaim all liability to you for damages, costs and expenses, including legal fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.
1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you discover a defect in this electronic work within 90 days of receiving it, you can receive a refund of the money (if any) you paid for it by sending a written explanation to the person you received the work from. If you received the work on a physical medium, you must return the medium with your written explanation. The person or entity that provided you with the defective work may elect to provide a replacement copy in lieu of a refund. If you received the work electronically, the person or entity providing it to you may choose to give you a second opportunity to receive the work electronically in lieu of a refund. If the second copy is also defective, you may demand a refund in writing without further opportunities to fix the problem.
1.F.4. Except for the limited right of replacement or refund set forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
1.F.5. Some states do not allow disclaimers of certain implied warranties or the exclusion or limitation of certain types of damages. If any disclaimer or limitation set forth in this agreement violates the law of the state applicable to this agreement, the agreement shall be interpreted to make the maximum disclaimer or limitation permitted by the applicable state law. The invalidity or unenforceability of any provision of this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation, the trademark owner, any agent or employee of the Foundation, anyone providing copies of Project Gutenberg™ electronic works in accordance with this agreement, and any volunteers associated with the production, promotion and distribution of Project Gutenberg™ electronic works, harmless from all liability, costs and expenses, including legal fees, that arise directly or indirectly from any of the following which you do or cause to occur: (a) distribution of this or any Project Gutenberg™ work, (b) alteration, modification, or additions or deletions to any Project Gutenberg™ work, and (c) any Defect you cause.
Section 2. Information about the Mission of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of electronic works in formats readable by the widest variety of computers including obsolete, old, middle-aged and new computers. It exists because of the efforts of hundreds of volunteers and donations from people in all walks of life.
Volunteers and financial support to provide volunteers with the assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™ collection will remain freely available for generations to come. In 2001, the Project Gutenberg Literary Archive Foundation was created to provide a secure and permanent future for Project Gutenberg™ and future generations. To learn more about the Project Gutenberg Literary Archive Foundation and how your efforts and donations can help, see Sections 3 and 4 and the Foundation information page at www.gutenberg.org.
Section 3. Information about the Project Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a nonprofit 501(c)(3) educational corporation organized under the laws of the state of Mississippi and granted tax exempt status by the Internal Revenue Service. The Foundation’s EIN or federal tax identification number is 64-6221541. Contributions to the Project Gutenberg Literary Archive Foundation are tax deductible to the full extent permitted by U.S. federal laws and your state’s laws.
The Foundation’s business office is located at 809 North 1500 West, Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up to date contact information can be found at the Foundation’s website and official page at www.gutenberg.org/contact
Section 4. Information about Donations to the Project Gutenberg Literary Archive Foundation
Project Gutenberg™ depends upon and cannot survive without widespread public support and donations to carry out its mission of increasing the number of public domain and licensed works that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated equipment. Many small donations ($1 to $5,000) are particularly important to maintaining tax exempt status with the IRS.
The Foundation is committed to complying with the laws regulating charities and charitable donations in all 50 states of the United States. Compliance requirements are not uniform and it takes a considerable effort, much paperwork and many fees to meet and keep up with these requirements. We do not solicit donations in locations where we have not received written confirmation of compliance. To SEND DONATIONS or determine the status of compliance for any particular state visit www.gutenberg.org/donate.
While we cannot and do not solicit contributions from states where we have not met the solicitation requirements, we know of no prohibition against accepting unsolicited donations from donors in such states who approach us with offers to donate.
International donations are gratefully accepted, but we cannot make any statements concerning tax treatment of donations received from outside the United States. U.S. laws alone swamp our small staff.
Please check the Project Gutenberg web pages for current donation methods and addresses. Donations are accepted in a number of other ways including checks, online payments and credit card donations. To donate, please visit: www.gutenberg.org/donate.
Section 5. General Information About Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project Gutenberg™ concept of a library of electronic works that could be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of volunteer support.
Project Gutenberg™ eBooks are often created from several printed editions, all of which are confirmed as not protected by copyright in the U.S. unless a copyright notice is included. Thus, we do not necessarily keep eBooks in compliance with any particular paper edition.
Most people start at our website which has the main PG search facility: www.gutenberg.org.
This website includes information about Project Gutenberg™, including how to make donations to the Project Gutenberg Literary Archive Foundation, how to help produce our new eBooks, and how to subscribe to our email newsletter to hear about new eBooks.