100% found this document useful (4 votes)
726 views

PostgreSQL Development Essentials 1st Edition Kaur download pdf

Essentials

Uploaded by

chichaapena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
726 views

PostgreSQL Development Essentials 1st Edition Kaur download pdf

Essentials

Uploaded by

chichaapena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Download Full ebookname - Read Now at ebookname.

com

PostgreSQL Development Essentials 1st Edition Kaur

https://ebookname.com/product/postgresql-development-
essentials-1st-edition-kaur/

OR CLICK BUTTON

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Game Development Essentials An Introduction 3rd Edition


Jeannie Novak

https://ebookname.com/product/game-development-essentials-an-
introduction-3rd-edition-jeannie-novak/

ebookname.com

PostgreSQL High Availability Cookbook 2nd Edition Shaun M.


Thomas

https://ebookname.com/product/postgresql-high-availability-
cookbook-2nd-edition-shaun-m-thomas/

ebookname.com

Marmalade SDK Mobile Game Development Essentials 1st New


edition Edition Sean Scaplehorn

https://ebookname.com/product/marmalade-sdk-mobile-game-development-
essentials-1st-new-edition-edition-sean-scaplehorn/

ebookname.com

The Ancestral Constitution Four Studies in Athenian Party


Politics at the End of the Fifth Century B C 1st Edition
Alexander Fuks
https://ebookname.com/product/the-ancestral-constitution-four-studies-
in-athenian-party-politics-at-the-end-of-the-fifth-century-b-c-1st-
edition-alexander-fuks/
ebookname.com
Las Románticas Susan Kirkpatrick

https://ebookname.com/product/las-romanticas-susan-kirkpatrick/

ebookname.com

English Irish and Subversives among the Dismal Scientists


1st Edition Noel W. Thompson

https://ebookname.com/product/english-irish-and-subversives-among-the-
dismal-scientists-1st-edition-noel-w-thompson/

ebookname.com

Between Morality and the Law Corruption Anthropology and


Comparative Society 1st Edition Italo Pardo

https://ebookname.com/product/between-morality-and-the-law-corruption-
anthropology-and-comparative-society-1st-edition-italo-pardo/

ebookname.com

Breaking the Fourth Wall Direct Address in the Cinema 1st


Edition Tom Brown

https://ebookname.com/product/breaking-the-fourth-wall-direct-address-
in-the-cinema-1st-edition-tom-brown/

ebookname.com

Breadlines knee deep in wheat food assistance in the Great


Depression Nestle

https://ebookname.com/product/breadlines-knee-deep-in-wheat-food-
assistance-in-the-great-depression-nestle/

ebookname.com
The Oxford Handbook of the Word Oxford Handbooks John R.
Taylor

https://ebookname.com/product/the-oxford-handbook-of-the-word-oxford-
handbooks-john-r-taylor/

ebookname.com
PostgreSQL Development
Essentials

Develop programmatic functions to create powerful database


applications

Manpreet Kaur
Baji Shaik

BIRMINGHAM - MUMBAI
PostgreSQL Development Essentials
Copyright © 2016 Packt Publishing

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 authors, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be 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.

First published: September 2016

Production reference: 1200916

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78398-900-3
www.packtpub.com
Credits

Authors Copy Editor

Manpreet Kaur Zainab Bootwala

Baji Shaik

Reviewers Project Coordinator

Daniel Durante Izzat Contractor

Danny Sauer

Commissioning Editor Proofreader

Julian Ursell Safis Editing

Acquisition Editor Indexer

Nitin Dasan Rekha Nair

Content Development Editor Graphics

Anish Sukumaran Jason Monteiro

Technical Editor Production Coordinator

Sunith Shetty Aparna Bhagat


About the Authors
Manpreet Kaur currently works as a business intelligence solution developer at an IT-based
MNC in Chandigarh. She has over 7 years of work experience in the field of developing
successful analytical solutions in data warehousing, analytics and reporting, and portal and
dashboard development in the PostgreSQL and Oracle databases. She has worked on
business intelligence tools such as Noetix, SSRS, Tableau, and OBIEE. She has a good
understanding of ETL tools such as Informatica and Oracle Data Integrator (ODI).
Currently, she works on analytical solutions using Hadoop and OBIEE 12c.

Additionally, she is very creative and enjoys oil painting. She also has a youtube channel,
Oh so homemade, where she posts easy ways to make recycled crafts.

Baji Shaik is a database administrator and developer. He is currently working as a database


consultant at OpenSCG. He has an engineering degree in telecommunications, and he
started his career as a C# and Java developer. He started working with databases in 2011
and, over the years, he has worked with Oracle, PostgreSQL, and Greenplum. His
background spans a wide depth and breadth of expertise and experience in SQL/NoSQL
database technologies. He has architectured and designed many successful database
solutions addressing challenging business requirements. He has provided solutions using
PostgreSQL for reporting, business intelligence, data warehousing, applications, and
development support. He has a good knowledge of automation, orchestration, and DevOps
in a cloud environment.

He comes from a small village named Vutukutu in Andhra Pradesh and currently lives in
Hyderabad. He likes to watch movies, read books, and write technical blogs. He loves to
spend time with family. He has tech-reviewed Troubleshooting PostgreSQL by Packt
Publishing. He is a certified PostgreSQL professional.

Thanks to my loving parents. Thanks to Packt Publishing for giving me this opportunity.
Special thanks to Izzat Contractor for choosing me, and Anish Sukumaran, Nitin Dasan,
and Sunith Shetty for working with me. Thanks to Dinesh Kumar for helping me write.
About the Reviewers
Daniel Durante started spending time with computers at the age of 12. He has built
applications for various sectors, such as the medical industry, universities, the
manufacturing industry, and the open source community. He mainly uses Golang, C, Node,
or PHP for developing web applications, frameworks, tools, embedded systems, and so
on. Some of his personal work can be found on GitHub and his personal website.

He has also worked on the PostgreSQL Developer's Guide, published by Packt Publishing.

I would like to thank my parents, brother, and friends, who’ve all put up with my insanity,
day in and day out. I would not be here today if it weren’t for their patience, guidance, and
love.

Danny Sauer has been a Linux sysadmin, software developer, security engineer, open
source advocate, and general computer geek at various companies for around 20 years. He
has administered, used, and programmed PostgreSQL for over half of that time. When he's
not building solutions in the digital world, he and his wife enjoy restoring their antique
home and teaching old cars new tricks.
www.PacktPub.com
eBooks, discount offers, and more
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters and receive exclusive discounts and offers on Packt books and
eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book
library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Table of Contents
Preface 1
Chapter 1: Advanced SQL 5
Creating views 5
Deleting and replacing views 7
Materialized views 8
Why materialized views? 8
Read-only, updatable, and writeable materialized views 8
Read-only materialized views 9
Updatable materialized views 9
Writeable materialized views 10
Creating cursors 10
Using cursors 11
Closing a cursor 12
Using the GROUP BY clause 12
Using the HAVING clause 14
Parameters or arguments 14
Using the UPDATE operation clauses 15
Using the LIMIT clause 15
Using subqueries 16
Subqueries that return multiple rows 18
Correlated subqueries 18
Existence subqueries 19
Parameters or arguments 19
Using the Union join 20
Using the Self join 21
Using the Outer join 22
Left outer join 23
Right outer join 24
Full outer join 24
Summary 26
Chapter 2: Data Manipulation 27
Conversion between datatypes 27
Introduction to arrays 28
Array constructors 28
String_to_array() 31
Array_dims( ) 32
ARRAY_AGG() 32
ARRAY_UPPER() 34
Array_length() 34
Array slicing and splicing 34
UNNESTing arrays to rows 35
Introduction to JSON 37
Inserting JSON data in PostgreSQL 37
Querying JSON 38
Equality operation 38
Containment 38
Key/element existence 39
Outputting JSON 40
Using XML in PostgreSQL 41
Inserting XML data in PostgreSQL 41
Querying XML data 42
Composite datatype 42
Creating composite types in PostgreSQL 42
Altering composite types in PostgreSQL 44
Dropping composite types in PostgreSQL 45
Summary 45
Chapter 3: Triggers 46
Introduction to triggers 46
Adding triggers to PostgreSQL 47
Modifying triggers in PostgreSQL 52
Removing a trigger function 53
Creating a trigger function 54
Testing the trigger function 55
Viewing existing triggers 56
Summary 57
Chapter 4: Understanding Database Design Concepts 58
Basic design rules 58
The ability to solve the problem 58
The ability to hold the required data 59
The ability to support relationships 59
The ability to impose data integrity 59
The ability to impose data efficiency 59
The ability to accommodate future changes 59
Normalization 60
Anomalies in DBMS 60

[ ii ]
First normal form 62
Second normal form 62
Third normal form 63
Common patterns 64
Many-to-many relationships 64
Hierarchy 65
Recursive relationships 66
Summary 67
Chapter 5: Transactions and Locking 68
Defining transactions 68
ACID rules 69
Effect of concurrency on transactions 70
Transactions and savepoints 70
Transaction isolation 71
Implementing isolation levels 72
Dirty reads 72
Non-repeatable reads 73
Phantom reads 74
ANSI isolation levels 74
Transaction isolation levels 75
Changing the isolation level 75
Using explicit and implicit transactions 76
Avoiding deadlocks 76
Explicit locking 77
Locking rows 77
Locking tables 78
Summary 79
Chapter 6: Indexes and Constraints 81
Introduction to indexes and constraints 81
Primary key indexes 82
Unique indexes 83
B-tree indexes 84
Standard indexes 85
Full text indexes 86
Partial indexes 86
Multicolumn indexes 88
Hash indexes 89
GIN and GiST indexes 89
Clustering on an index 90
Foreign key constraints 91

[ iii ]
Unique constraints 92
Check constraints 94
NOT NULL constraints 95
Exclusion constraints 96
Summary 96
Chapter 7: Table Partitioning 97
Table partitioning 97
Partition implementation 102
Partitioning types 107
List partition 107
Managing partitions 109
Adding a new partition 109
Purging an old partition 110
Alternate partitioning methods 111
Method 1 111
Method 2 112
Constraint exclusion 114
Horizontal partitioning 116
PL/Proxy 117
Foreign inheritance 118
Summary 121
Chapter 8: Query Tuning and Optimization 122
Query tuning 122
Hot versus cold cache 123
Cleaning the cache 124
pg_buffercache 127
pg_prewarm 129
Optimizer settings for cached data 130
Multiple ways to implement a query 132
Bad query performance with stale statistics 134
Optimizer hints 136
Explain Plan 141
Generating and reading the Explain Plan 141
Simple example 142
More complex example 142
Query operators 143
Seq Scan 143
Index Scan 143
Sort 144
Unique 144

[ iv ]
LIMIT 144
Aggregate 144
Append 144
Result 144
Nested Loop 145
Merge Join 145
Hash and Hash Join 145
Group 145
Subquery Scan and Subplan 145
Tid Scan 145
Materialize 146
Setop 146
Summary 146
Chapter 9: PostgreSQL Extensions and Large Object Support 147
Creating an extension 147
Compiling extensions 149
Database links in PostgreSQL 150
Using binary large objects 153
Creating a large object 154
Importing a large object 154
Exporting a large object 155
Writing data to a large object 155
Server-side functions 155
Summary 156
Chapter 10: Using PHP in PostgreSQL 157
Postgres with PHP 157
PHP-to-PostgreSQL connections 158
Dealing with DDLs 161
DML operations 162
pg_query_params 163
pg_insert 164
Data retrieval 165
pg_fetch_all 165
pg_fetch_assoc 166
pg_fetch_result 167
Helper functions to deal with data fetching 168
pg_free_results 168
pg_num_rows 168

[v]
pg_num_fields 168
pg_field_name 168
pg_meta_data 168
pg_convert 169
UPDATE 171
DELETE 172
COPY 172
Summary 174
Chapter 11: Using Java in PostgreSQL 175
Making database connections to PostgreSQL using Java 175
Using Java to create a PostgreSQL table 178
Using Java to insert records into a PostgreSQL table 179
Using Java to update records into a PostgreSQL table 180
Using Java to delete records into a PostgreSQL table 181
Catching exceptions 182
Using prepared statements 184
Loading data using COPY 184
Connection properties 186
Summary 187
Index 188

[ vi ]
Preface
The purpose of this book is to teach you the fundamental practices and techniques of
database developers for programming database applications with PostgreSQL. It is targeted
to database developers using PostgreSQL who have basic experience developing database
applications with the system, but want a deeper understanding of how to implement
programmatic functions with PostgreSQL.

What this book covers


Chapter 1, Advanced SQL, aims to help you understand advanced SQL topics such as views,
materialized views, and cursors and will be able to get a sound understanding of complex
topics such as subqueries and joins.

Chapter 2, Data Manipulation, provides you the ability to perform data type conversions
and perform JSON and XML operations in PostgreSQL.

Chapter 3, Triggers, explains how to perform trigger operations and use trigger functions in
PostgreSQL.

Chapter 4, Understanding Database Design Concepts, explains data modeling and


normalization concepts. The reader will then be able to efficiently create a robust database
design.

Chapter 5, Transactions and Locking, covers the effect of transactions and locking on the
database.The reader will also be able to understand isolation levels and understand multi-
version concurrency control behavior.

Chapter 6, Indexes And Constraints, provides knowledge about the different indexes and
constraints available in PostgreSQL. This knowledge will help the reader while coding and
the reader will be in a better position to choose among the different indexes and constraints
depending upon the requirement during the coding phase.

Chapter 7, Table Partitioning, gives the reader a better understanding of partitioning in


PostgreSQL. The reader will be able to use the different partitioning methods available in
PostgreSQL and also implement horizontal partitioning using PL/Proxy.
Preface

Chapter 8, Query Tuning and Optimization, provides knowledge about different mechanisms
and approaches available to tune a query. The reader will be able to utilize this knowledge
in order to write a optimal/efficient query or code.

Chapter 9, PostgreSQL Extensions and Large Object Support, will familiarize the reader with
the concept of extensions in PostgreSQL and also with the usage of large objects' datatypes
in PostgreSQL.

Chapter 10, Using PHP in PostgreSQL, covers the basics of performing database operations
in PostgreSQL using the PHP language, which helps reader to start with PHP code.

Chapter 11, Using Java in PostgreSQL, this chapter provides knowledge about database
connectivity using Java and creating/modifying objects using Java code. It also talks about
JDBC drivers.

What you need for this book


You need PostgreSQL 9.4 or higher to be installed on your machine to test the codes
provided in the book. As this covers Java and PHP, you need Java and PHP binaries
installed on your machine. All other tools covered in this book have installation procedures
included, so there's no need to install them before you start reading the book.

Who this book is for


This book is mainly for PostgreSQL developers who want to develop applications using
programming languages. It is also useful for tuning databases through query optimization,
indexing, and partitioning.

Conventions
In this book, you will find a number of text styles that distinguish between different kinds
of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Database
views are created using the CREATE VIEW statement. "

[2]
Preface

A block of code is set as follows:


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;

Any command-line input or output is written as follows:


CREATE VIEW view_name AS
SELECT column1, column2
FROM table_name
WHERE [condition];

New terms and important words are shown in bold.

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or disliked. Reader feedback is important for us as it helps us
develop titles that you will really get the most out of. To send us general feedback, simply
e-mail [email protected], and mention the book's title in the subject of your
message. If there is a topic that you have expertise in and you are interested in either
writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you
to get the most from your purchase.

[3]
Preface

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-
we would be grateful if you could report this to us. By doing so, you can save other readers
from frustration and help us improve subsequent versions of this book. If you find any
errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting
your book, clicking on the Errata Submission Form link, and entering the details of your
errata. Once your errata are verified, your submission will be accepted and the errata will
be uploaded to our website or added to any list of existing errata under the Errata section of
that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/conten


t/support and enter the name of the book in the search field. The required information will
appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At
Packt, we take the protection of our copyright and licenses very seriously. If you come
across any illegal copies of our works in any form on the Internet, please provide us with
the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated


material.

We appreciate your help in protecting our authors and our ability to bring you valuable
content.

Questions
If you have a problem with any aspect of this book, you can contact us
at [email protected], and we will do our best to address the problem.

[4]
Advanced SQL
1
This book is all about an open source software product, a relational database called
PostgreSQL. PostgreSQL is an advanced SQL database server, available on a wide range of
platforms. The purpose of this book is to teach database developers the fundamental
practices and techniques to program database applications with PostgreSQL.

In this chapter, we will discuss the following advanced SQL topics:

Creating views
Understanding materialized views
Creating cursors
Using the GROUP BY clause
Using the HAVING clause
Understanding complex topics such as subqueries and joins

Creating views
A view is a virtual table based on the result set of an SQL statement. Just like a real table, a
view consist of rows and columns. The fields in a view are from one or more real tables in
the database. Generally speaking, a table has a set of definitions that physically stores data.
A view also has a set of definitions built on top of table(s) or other view(s) that does not
physically store data. The purpose of creating views is to make sure that the user does not
have access to all the data and is being restricted through a view. Also, it's better to create a
view if we have a query based on multiple tables so that we can use it straightaway rather
than writing a whole PSQL again and again.

Database views are created using the CREATE VIEW statement. Views can be created from a
single table or multiple tables, or another view.
Advanced SQL

The basic CREATEVIEW syntax is as follows:


CREATE VIEW view_name AS
SELECT column1, column2
FROM table_name
WHERE [condition];

Let's take a look at each of these commands:

CREATE VIEW: This command helps create the database's view.


SELECT: This command helps you select the physical and virtual columns that
you want as part of the view.
FROM: This command gives the table names with an alias from where we can fetch
the columns. This may include one or more table names, considering you have to
create a view at the top of multiple tables.
WHERE: This command provides a condition that will restrict the data for a view.
Also, if you include multiple tables in the FROM clause, you can provide the
joining condition under the WHERE clause.

You can then query this view as though it were a table. (In PostgreSQL, at the time of
writing, views are read-only by default.) You can SELECT data from a view just as you
would from a table and join it to other tables; you can also use WHERE clauses. Each time
you execute a SELECT query using the view, the data is rebuilt, so it is always up-to-date. It
is not a frozen copy stored at the time the view was created.

Let's create a view on supplier and order tables. But, before that, let's see what the structure
of the suppliers and orders table is:
CREATE TABLE suppliers
(supplier_id number primary key,
Supplier_name varchar(30),
Phone_number number);
CREATE TABLE orders
(order_number number primary key,
Supplier_id number references suppliers(supplier_id),
Quanity number,
Is_active varchar(10),
Price number);
CREATE VIEW active_supplier_orders AS
SELECT suppliers.supplier_id, suppliers.supplier_name orders.quantity,
orders.price
FROM suppliers
INNER JOIN orders
ON suppliers.supplier_id = orders.supplier_id
WHERE suppliers.supplier_name = 'XYZ COMPANY'

[6]
Advanced SQL

And orders.active='TRUE';

The preceding example will create a virtual table based on the result set of the SELECT
statement. You can now query the PostgreSQL VIEW as follows:
SELECT * FROM active_supplier_orders;

Deleting and replacing views


To delete a view, simply use the DROP VIEW statement with view_name. The basic
DROPVIEW syntax is as follows:

DROP VIEW IF EXISTS view_name;

If you want to replace an existing view with one that has the same name and returns the
same set of columns, you can use a CREATE OR REPLACE command.

The following is the syntax to modify an existing view:


CREATE OR REPLACE VIEW view_name AS
SELECT column_name(s)
FROM table_name(s)
WHERE condition;

Let's take a look at each of these commands:

CREATE OR REPLACE VIEW: This command helps modify the existing view.
SELECT: This command selects the columns that you want as part of the view.
FROM: This command gives the table name from where we can fetch the columns.
This may include one or more table names, since you have to create a view at the
top of multiple tables.
WHERE: This command provides the condition to restrict the data for a view. Also,
if you include multiple tables in the FROM clause, you can provide the joining
condition under the WHERE clause.

Let's modify a view, supplier_orders, by adding some more columns in the view. The
view was originally based on supplier and order tables having supplier_id,
supplier_name, quantity, and price. Let's also add order_number in the view.

CREATE OR REPLACE VIEW active_supplier_orders AS


SELECT suppliers.supplier_id, suppliers.supplier_name orders.quantity,
orders.price,order. order_number
FROM suppliers

[7]
Advanced SQL

INNER JOIN orders


ON suppliers.supplier_id = orders.supplier_id
WHERE suppliers.supplier_name = 'XYZ COMPANY'
And orders.active='TRUE';;

Materialized views
A materialized view is a table that actually contains rows but behaves like a view. This has
been added in the PostgreSQL 9.3 version. A materialized view cannot subsequently be
directly updated, and the query used to create the materialized view is stored in exactly the
same way as the view's query is stored. As it holds the actual data, it occupies space as per
the filters that we applied while creating the materialized view.

Why materialized views?


Before we get too deep into how to implement materialized views, let's first examine why
we may want to use materialized views.

You may notice that certain queries are very slow. You may have exhausted all the
techniques in the standard bag of techniques to speed up those queries. In the end, you will
realize that getting queries to run as fast as you want simply isn't possible without
completely restructuring the data.

Now, if you have an environment where you run the same type of SELECT query multiple
times against the same set of tables, then you can create a materialized view for SELECT so
that, on every run, this view does not go to the actual tables to fetch the data, which will
obviously reduce the load on them as you might be running a Data Manipulation
Language (DML) against your actual tables at the same time. So, basically, you take a view
and turn it into a real table that holds real data rather than a gateway to a SELECT query.

Read-only, updatable, and writeable materialized views


A materialized view can be read-only, updatable, or writeable. Users cannot perform DML
statements on read-only materialized views, but they can perform them on updatable and
writeable materialized views.

[8]
Advanced SQL

Read-only materialized views


You can make a materialized view read-only during creation by omitting the FOR UPDATE
clause or by disabling the equivalent option in the database management tool. Read-only
materialized views use many mechanisms similar to updatable materialized views, except
they do not need to belong to a materialized view group.

In a replication environment, a materialized table holds the table data and resides in a
different database. A table that has a materialized view on it is called a master table. The
master table resides on a master site and the materialized view resides on a materialized-
view site.

In addition, using read-only materialized views eliminates the possibility of introducing


data conflicts on the master site or the master materialized view site, although this
convenience means that updates cannot be made on the remote materialized view site.

The syntax to create a materialized view is as follows:


CREATE MATERIALIZED VIEW view_name AS SELECT columns FROM table;

The CREATE MATERIALIZED VIEW command helps us create a materialized view. The
command acts in way similar to the CREATE VIEW command, which was explained in the
previous section.

Let's make a read-only materialized view for a supplier table:


CREATE MATERIALIZED VIEW suppliers_matview AS
SELECT * FROM suppliers;

This view is a read-only materialized view and will not reflect the changes to the master
site.

Updatable materialized views


You can make a materialized view updatable during creation by including the FOR UPDATE
clause or enabling the equivalent option in the database management tool. In order for
changes that have been made to an updatable materialized view to be reflected in the
master site during refresh, the updatable materialized view must belong to a materialized
view group.

When we say “refreshing the materialized view,” we mean synchronizing the data in the
materialized view with data in its master table.

[9]
Advanced SQL

An updatable materialized view enables you to decrease the load on master sites because
users can make changes to data on the materialized view site.

The syntax to create an updatable materialized view is as follows:


CREATE MATERIALIZED VIEW view_name FOR UPDATE
AS
SELECT columns FROM table;

Let's make an updatable materialized view for a supplier table:


CREATE MATERIALIZED VIEW suppliers_matview FOR UPDATE
AS
SELECT * FROM suppliers;

Whenever changes are made in the suppliers_matview clause, it will reflect the changes
to the master sites during refresh.

Writeable materialized views


A writeable materialized view is one that is created using the FOR UPDATE clause like an
updatable materialized view is, but it is not a part of a materialized view group. Users can
perform DML operations on a writeable materialized view; however, if you refresh the
materialized view, then these changes are not pushed back to the master site and are lost in
the materialized view itself. Writeable materialized views are typically allowed wherever
fast-refreshable, read-only materialized views are allowed.

Creating cursors
A cursor in PostgreSQL is a read-only pointer to a fully executed SELECT statement's result
set. Cursors are typically used within applications that maintain a persistent connection to
the PostgreSQL backend. By executing a cursor and maintaining a reference to its returned
result set, an application can more efficiently manage which rows to retrieve from a result
set at different times without re-executing the query with different LIMIT and OFFSET
clauses.

The four SQL commands involved with PostgreSQL cursors are DECLARE, FETCH, MOVE, and
CLOSE.

[ 10 ]
Advanced SQL

The DECLARE command both defines and opens a cursor, in effect defining the cursor in
memory, and then populates the cursor with information about the result set returned from
the executed query. A cursor may be declared only within an existing transaction block, so
you must execute a BEGIN command prior to declaring a cursor.

Here is the syntax for DECLARE:


DECLARE cursorname [ BINARY ] [ INSENSITIVE ] [ SCROLL ] CURSOR FOR query
[ FOR { READ ONLY | UPDATE [ OF column [, ...] ] } ]

DECLARE cursorname is the name of the cursor to create. The optional BINARY keyword
causes the output to be retrieved in binary format instead of standard ASCII; this can be
more efficient, though it is only relevant to custom applications as clients such as psql are
not built to handle anything but text output. The INSENSITIVE and SCROLL keywords exist
to comply with the SQL standard, though they each define PostgreSQL's default behavior
and are never necessary. The INSENSITIVE SQL keyword exists to ensure that all data
retrieved from the cursor remains unchanged from other cursors or connections. As
PostgreSQL requires the cursors to be defined within transaction blocks, this behavior is
already implied. The SCROLL SQL keyword exists to specify that multiple rows at a time
can be selected from the cursor. This is the default in PostgreSQL, even if it is unspecified.

The CURSOR FOR query is the complete query and its result set will be accessible by the
cursor when executed.

The [FOR { READ ONLY | UPDATE [ OF column [, ...] ] } ] cursors may only be
defined as READ ONLY, and the FOR clause is, therefore, superfluous.

Let's begin a transaction block with the BEGIN keyword, and open a cursor named
order_cur with SELECT * FROM orders as its executed select statement:

BEGIN;
DECLARE order_cur CURSOR
FOR SELECT * FROM orders;

Once the cursor is successfully declared, it means that the rows retrieved by the query are
now accessible from the order_cur cursor.

Using cursors
In order to retrieve rows from the open cursor, we need to use the FETCH command. The
MOVE command moves the current location of the cursor within the result set and the CLOSE
command closes the cursor, freeing up any associated memory.

[ 11 ]
Advanced SQL

Here is the syntax for the FETCH SQL command:


FETCH [ FORWARD | BACKWARD]
[ # | ALL | NEXT | PRIOR ]
{ IN | FROM }
cursor

cursor is the name of the cursor from where we can retrieve row data. A cursor always
points to a current position in the executed statement's result set and rows can be retrieved
either ahead of the current location or behind it. The FORWARD and BACKWARD keywords
may be used to specify the direction, though the default is forward. The NEXT keyword (the
default) returns the next single row from the current cursor position. The PRIOR keyword
causes the single row preceding the current cursor position to be returned.

Let's consider an example that fetches the first four rows stored in the result set, pointed to
by the order_cur cursor. As a direction is not specified, FORWARD is implied. It then uses a
FETCH statement with the NEXT keyword to select the fifth row, and then another FETCH
statement with the PRIOR keyword to again select the fourth retrieved row.
FETCH 4 FROM order_cur;

In this case, the first four rows will be fetched.

Closing a cursor
You can use the CLOSE command to explicitly close an open cursor. A cursor can also be
implicitly closed if the transaction block that it resides within is committed with the COMMIT
command, or rolled back with the ROLLBACK command.

Here is the syntax for the CLOSE command, where Cursorname is the name of the cursor
intended to be closed:
CLOSE
Cursorname;

Using the GROUP BY clause


The GROUP BY clause enables you to establish data groups based on columns. The grouping
criterion is defined by the GROUP BY clause, which is followed by the WHERE clause in the
SQL execution path. Following this execution path, the result set rows are grouped based
on like values of grouping columns and the WHERE clause restricts the entries in each group.

[ 12 ]
Random documents with unrelated
content Scribd suggests to you:
would be impossible for me now to go through it. If the weather
should grow hot, I may, at any time, go to the hills, the foot of which
is five or six miles distant. I drink goats’ milk, and have left off meat
since the cough came on, but design eating a little again at
dinner.”[436]

Two days after the date of this letter, Fletcher was


at Macon, whither he had gone to meet his friend Mr.
Ireland, on his return from Montpelier to England.
Whilst he was here, he wrote two letters, which must
be quoted. The first, addressed to “The Rev. Messrs.
John and Charles Wesley,” was as follows:—
“Macon, in Burgundy, May 17, 1778.
“Rev. and Dear Sirs,—I hope while I lie by, the Lord continues to
renew your vigour, and sends you to water His vineyard, and to stand
in the gap against error and vice.
“I preached twice at Marseilles, but was not permitted to follow the
blow. There are few noble, inquisitive Bereans in these parts. The
ministers in the town of my nativity have been very civil. They have
offered me the pulpit; but, I fear, if I could accept the offer, it would
soon be recalled. I am loath to quit this part of the field without
casting a stone at that giant, sin, who stalks about with uncommon
boldness. I shall, therefore, stay some months longer, to see if the
Lord will give me strength to venture an attack.
“Gambling and dress, sinful pleasure and love of money, unbelief
and false philosophy, lightness of spirit, fear of man, and love of the
world, are the principal sins by which Satan binds his captives in
these parts. Materialism is not rare; Deism and Socinianism are very
common; and a set of Free-thinkers, great admirers of Voltaire[437]
and Rosseau, Bayle and Mirabeau, seem bent upon destroying
Christianity and government. If we believe them, the world is the
dupe of kings and priests. Religion is fanaticism and superstition.
Subordination is slavery. Christian morality is absurd, unnatural, and
impracticable; and Christianity the most bloody religion that ever
was. And here it is certain, that, by the example of Christians so
called, and by our continual disputes, they have a great advantage,
and do the truth immense mischief. Popery will certainly fall in
France, in this or the next century; and I have no doubt God will use
those vain men to bring about a reformation here, as he used Henry
the Eighth to do that work in England; so the madness of His
enemies shall, at last, turn to His praise, and to the futherance of His
kingdom.
“In the meantime, it becomes all lovers of the truth to make their
heavenly tempers, and humble, peaceful love to shine before all
men, that those mighty adversaries, seeing the good works of
professors, may glorify their Father who is in heaven, and no more
blaspheme that worthy name, by which we are all called Christians.
“If you ask, what system these men adopt? I answer, some build
on Deism a morality founded on self-preservation, self-interest, and
self-honour. Others laugh at all morality, except that which being
neglected violently disturbs society. And external order is the decent
covering of Fatalism, while Materialism is their system.
“Oh, dear Sirs, let me entreat you, in these dangerous days, to use
your wide influence, with unabated zeal, against the scheme of these
modern Celsuses, Porphyries, and Julians, by calling all professors to
think and speak the same things, to love and embrace one another,
and to firmly resist those daring men; many of whom are already in
England, headed by the admirers of Mr. Hume and Mr. Hobbes. But it
is needless to say this to those who have made, and continue to
make, such a stand for vital Christianity; so that I have nothing to do
but pray that the Lord may abundantly support and strengthen you,
and make you a continued comfort to His enlightened people, loving
reprovers of those who mix light with darkness, and a terror to the
perverse.
“I need not tell you, Sirs, that the hour in which Providence shall
make my way plain to return to England, to unite with those who feel
or seek the power of Christian godliness, will be welcome to me. O
favoured Britons! Happy would it be for them, if they knew their
Gospel privileges!
“My relations in Adam are all very kind to me; but the spiritual
relations, whom God has raised me in England, exceed them yet.
Thanks be to Christ, and to His blasphemed religion!
“I am, Rev. Sirs, your affectionate son, and obliged servant in the
Gospel,
“J. Fletcher.”[438]

On the day after the date of this letter, Fletcher


wrote the following to the Rev. Dr. Conyers, another
Methodist Clergyman, to whom he had sent his
“Reconciliation; or, an easy Method to unite the
people of God,” published in 1777:—
“Macon, in Burgundy, May 18, 1778.
“Hon. and Dear Sir,—I left orders, with a friend, to send you a little
book called ‘The Reconciliation,’ in which I endeavour to bring nearer
the children of God, who are divided about their partial views of
divine truths. I know not whether that tract has, in any degree,
answered its design; but I believe truth can be reconciled with itself,
and the candid children of God one with another. O that some abler
hand, and more loving heart, would undertake to mend my plan, or
draw one more agreeable to the Word of God! My eyes are upon
you, dear Sir, and those who are like-minded with you, for this work.
Disappoint not my hope. Stand forth, and make way for reconciling
love, by removing, so far as lies in you, what is in the way of
brotherly union.
“O Sir! the work is worthy of you. If you saw with what boldness
the false philosophers of the continent, who are the apostles of the
age, attack Christianity, and represent it as one of the worst religions
in the world, and fit only to make the professors of it murder one
another, or at least to contend among themselves, and how they
urge our disputes to make the Gospel of Christ the jest of nations,
and the abhorrence of all flesh, you would break through your
natural timidity, and invite all our brethren in the ministry to unite
and form a close battalion, and face the common enemy.
“O dear Sir! take courage. Be bold for reconciling truth. Be bold for
peace. You can do all things through Christ strengthening you; and,
as Doctor Conyers, you can do many things, a great many more than
you think. What if you go, Sir, in Christ’s name, to all the Gospel
ministers of your acquaintance, exhort them as a father, entreat
them as a brother, and bring them, or as many of them as you can,
together? Think you that your labour would be in vain in the Lord?
Impossible, Sir! O despair not. If you want a coach, or a friend to
accompany you, when you go upon this errand of love, remember
there is a Thornton in London, and an Ireland in Bristol, who will
wish you God speed; and God will raise many more to concur in the
peaceful work.
“Let me humbly entreat you to go to work, and to persevere in it. I
wish I had strength to be, at least, your postilion when you go. I
would drive, if not like Jehu, at least with some degree of cheerful
swiftness, while Christ smiled on the Christian attempt. But I am
confident you can do all in the absence of him, who is, with brotherly
love, and dutiful respect, Hon. and dear Sir, your obedient servant in
the Gospel,
“J. Fletcher.”[439]

Dr. Conyers, to whom this letter was addressed,


was a notable man. Born at Helmsley, Yorkshire, in
1725, he, in due time, became the Vicar of that
extensive parish. His conversion there, and his
labours, were remarkable. In 1765, he married Mrs.
Knipe, a rich and pious widow, the sister of the well-
known John Thornton, Esq., of Clapham. Three years
before the foregoing letter was written, Mr. Thornton
presented him to the living of St. Paul’s, Deptford;
and here he died in 1786, eight months after the
[440]
death of Fletcher. At the beginning of his
evangelical career, he was warmly attached to
Wesley, and a firm believer in the doctrines of the
Arminians. Afterwards, he was, to some extent,
influenced by certain of the Calvinian Ministers, with
whom he held converse; but, like his brother-in-law,
John Thornton, he was a lover of all good men; and,
occupying a kind of neutral position between the
contending parties, Fletcher deemed him well
qualified to bring about the reconciliation of the two.
At this period, the venerable Vicar of Shoreham
had been recently informed that he was entitled to a
valuable estate in Switzerland, and William Perronet,
Fletcher’s medical adviser in England, had undertaken
to visit Switzerland to enforce his father’s rights.
Before doing so, however, he wrote to Fletcher,
requesting his advice; and Fletcher’s reply was as
follows:—
“Nyon, June 2, 1778.
“My Dear Friend,—When I wrote to you last, I mentioned two ladies
of your family who have married two brothers, Messrs. Monod. Since
then, they have requested me to send your father the enclosed
memorial, which I hope will prove of use to your family. As the bad
writing and the language may make the understanding of it difficult,
I forward you the substance of it, and of the letter of the ladies’
lawyer.
“While I invite you to make your title clear to a precarious estate
on earth, permit me, my dear Sir, to remind you of the heavenly
inheritance entailed on believers. The will, the New Testament by
which we can recover it, is proved. The Court is just and equitable;
the Judge is gracious and loving. To enter into possession of a part of
the estate here, and of the whole hereafter, we need only believe
and prove evangelically that we are believers. Let us then set about
it now, with earnestness, with perseverance, and with a full
assurance that, through grace, we shall carry our cause. Alas! what
are estates and crowns to grace and glory?
“I have had a pull back since I wrote last. After I left Mr. Ireland at
Macon, to shorten my journey and enjoy new prospects, I ventured
to cross the mountains which separate France from this country. On
the third day of the journey, I found a large hill, whose winding roads
were so steep that, though we fed the horses with bread and wine,
they could scarcely draw the chaise, and I was obliged to walk in all
the steepest places. The climbing lasted several hours; the sun was
hot; I perspired violently; and the next day I spit blood again. I have
chiefly kept to goat’s milk ever since; I find myself better; and my
cough is neither frequent nor violent.
“This is a delightful country. If you come to see it, and to claim the
estate, bring all the papers and memorials you can collect; and share
a pleasant apartment, and one of the finest prospects in the world, in
the house where I was born. I design to try this fine air some
months longer. We have a fine shady wood near the lake, where I
can ride in the cool all the day, and enjoy the singing of a multitude
of birds. But this, though sweet, does not come up to the singing of
my dear friends in England. There I meet them in spirit several hours
in the day.”[441]

The ensuing letter, kindly lent by the Rev. Dr.


Knowles, of Tunbridge Wells, has not before been
published. It was addressed to “Mr. Power, Druggist,
in Broadmead, Bristol, Angleterre.”
“Nyon, June 20, 1778.
“Dear Sir,—A journey and my constant rides have hindered me
acknowledging sooner the favour of your observations and criticisms,
which I received some time ago. If I had my little publications here,
to turn to the pages you quote, I would immediately make notes,
and alter or rectify what you object to, as a preparation for a more
correct edition, should the work be ever reprinted. I wish all my
friends had taken as much pains about my works as you have, Sir;
they would by this time be more correct. Accept my sincere thanks
for the favour; and, if I live to see England again, we shall (please
God) talk the matter over fully.
“I am obliged to you for your caution about preaching. I have
followed it, and have not yet preached in this country, though I
believe I shall soon venture again upon it, but with care and in a
sparing manner. I hope at least the Lord will give me grace so to do.
“I heartily rejoice that Mrs. Power has been carried safely, a
second time, through the danger of child-bearing. May she and the
two fruits of her body live to the glory of God, and to your comfort!
Remember me kindly to her; and give my blessing to my god-son,
whose will, I hope, you continue to break with the wisdom, patience,
and steadiness which become a parent.
“I sent your mother a few lines by Mr. Ireland. I hope she received
them; but I shall never get an answer, if what he writes me is true.
Is she dead indeed? Sometimes I hope it is a rumour without
foundation; and yet his account that she died at Bath, where your
letter mentions she was gone, makes me fear he was well-informed.
If she is no more, you have lost a tender mother, and I a kind friend;
but the Lord will make up all our losses, and has already made them
up by giving us His Son. May we receive Him, and with Him all that is
excellent among the living and the dead! As she has been for many
years a woman of sorrow,—a true Hannah—wading almost
constantly through a sea of temptations, they may have followed her
to the last, and she may have escaped out of many tribulations, as
the saints mentioned in the Revelation. A line about it, and about
your welfare, and that of my god-son, will greatly oblige, dear Sir,
your obedient and already obliged servant,
J. Fletcher.
“My love to your brother, when you see him.”
The next letter, written to Mr. Ireland, contains a
sylvan scene worthy of being painted:—
“Nyon, July 15, 1778.
“My Dear Friend,—I have ventured to preach once, and to expound
once in the church. Our ministers are very kind, and preach to the
purpose. A young one of this town gave us lately a very excellent
gospel sermon.
“Grown-up people stand fast in their stupidity, or in their self-
righteousness. The day I preached, I met some children in my wood
gathering strawberries. I spoke to them about our common Father.
We felt a touch of brotherly affection. They said they would sing to
their Father, as well as the birds; and followed me, attempting to
make such melody as you know is commonly made in these parts. I
outrode them, but some of them had the patience to follow me
home; and said they would speak with me. The people of the house
stopped them, saying, I would not be troubled with children. They
cried, and said, they were sure I would not say so, for I was their
good brother. The next day, when I heard this, I enquired after
them, and invited them to come and see me; which they have done
every day since. I make them little hymns, which they sing. Some of
them are unde, sweet drawings. Yesterday, I wept for joy on hearing
one of them speak, as an experienced believer in Bristol would have
done, of conviction of sin, and of the joy unspeakable in Christ that
followed. Last Sunday, I met them in the wood; there were a
hundred of them, and as many adults. Our first pastor has since
desired me to desist from preaching in the wood (for I had
exhorted), for fear of giving umbrage; and I have complied, from a
concurrence of circumstances which are not worth mentioning; I
therefore now meet them in my father’s yard.”[442]

What a contrast to this scene of gentleness among


children is the following!
Fletcher had a nephew, who had been in the
Sardinian army, where his ungentlemanly and
profligate conduct had given such general offence to
his brother officers that they determined to compel
him to leave their corps, or to fight them all in
succession. After engaging in two or three duels, with
various success, the young bravo left the service, and
now, during Fletcher’s present visit, he returned to
Switzerland. His resources were soon spent in
profligacy; and, gaining access to his uncle, General
De Gons, he presented a loaded pistol, and said,
“Uncle De Gons, if you do not give me a draft on your
banker for five hundred crowns, I will shoot you.” The
General was a brave man, but, seeing himself in the
power of a desperado capable of any mischief, he
wrote the draft. “Uncle,” said the young fellow, “you
must do another thing; you must promise me, on
your honour, to use no means to recover the draft, or
to bring me to justice.” The General promised, and
the bandit rode away triumphantly. Passing the door
of his uncle Fletcher, he called upon him, and told
him General De Gons had generously given him five
hundred crowns. Fletcher doubted the truthfulness of
this statement. The draft was produced. “Let me see
it,” said Fletcher. It was handed to him. Fletcher
examined it, and remarked, “It is indeed my brother’s
writing, and it astonishes me; because my brother is
not wealthy, and I know that he justly disapproves
your conduct, and that you are the last in the family
to whom he would make such a present.” Then,
folding the draft and putting it into his pocket,
Fletcher added, “It strikes me, young man, that you
have obtained this draft improperly; and, in honesty,
I cannot return it without my brother’s approbation.”
Out came the pistol, and was levelled at Fletcher’s
breast. “Return it,” cried the young scoundrel, “or I
will take your life.” “My life,” calmly replied Fletcher,
“is secure in the protection of the Almighty Power
who guards it; nor will He suffer it to be the forfeit of
your rashness, or my integrity. Do you think that I,
who have been a minister of God for five-and-twenty
years, am afraid of death? It is for you to fear death,
who have every reason to fear it. You are a gamester
and a cheat, yet call yourself a gentleman! You are
the seducer of female innocence, and still you say
that you are a gentleman! You are a duellist and your
hand is red with blood, and for this you call yourself a
man of honour! Look there, Sir! look there! See, the
broad eye of heaven is upon us. Tremble in the
presence of your Maker, who can in a moment kill
your body, and for ever damn your soul!” The culprit
turned pale; then he argued, threatened, and
entreated. Sometimes, taking out his pistol, he fixed
himself against the door to prevent egress; and, at
other times, closed on frail Fletcher, menacing him
with instantaneous death. All was of no avail. The
poor country parson was as valorous as the most
heroic soldier. He gave no alarm to the family; he
sought no weapon; he attempted no escape; he
simply conversed with the calmness of a hero and a
saint. At length, the young fellow began to be
affected; and now, having gained the victory, Fletcher
addressed him in another strain: “I cannot return my
brother’s draft,” said he; “yet I feel for your distress,
and will endeavour to relieve it. My brother Gons, at
my request, I am sure will give you a hundred
crowns; I will do the same; perhaps my brother
Henry will do as much; and I hope your own family
will make up the five hundred crowns among them.”
Fletcher then fell upon his knees, and began to pray;
uncle and nephew parted, and the family, by
Fletcher’s mediation, furnished the young scapegrace
with the five hundred crowns he had feloniously
[443]
attempted to extort.
Amidst such scenes, Fletcher did not forget his
friends at Madeley. On July 18, he wrote three
messages:—
To his curate, the Rev. Mr. Greaves.—“I trust you lay yourself out
for the good of the flock committed to your care. I shall be glad to
hear that they grow in grace, and humble love.”

To the congregation in Madeley church.—“John Fletcher begs a


farther interest in the prayers of the congregation of Madeley; and
desires those, who assemble to serve God in the church, to help him
to return public thanks to Almighty God for many mercies received;
especially, for being able to do a little ministerial duty. He humbly
beseeches them to serve God as Christians, and to love one another
as brethren; neglecting no means of grace, and rejoicing in all the
hopes of glory.”

To the Methodist Societies “in Madeley, Dawley, and the


Banks.”—“We are all called to grow in grace, and, consequently, in
love, which is the greatest of all Christian graces. Your prayers for my
soul and my body have not been without answer. Blessed be God!
Glory be to His rich mercy in Christ, I live yet the life of faith; as to
my body, I recover some strength. God bless you all, with all the
blessings brought to the Church by Christ Jesus, and by the other
Comforter! My love to the preachers” (John Murlin and Robert
Roberts), “whom I beg you will thank in my name.”[444]

Two months later (September 15), he wrote to his


friend Thomas York:—
“Blessed be the God of all consolation, though I have still very
trying and feverish nights, I am kept in peace of mind; resigned to
His will, who afflicts me for my good, and justly sets me aside for my
unprofitableness. His grace within, and His people without, turn my
trying circumstances into matter of praise. Give my love to all your
dear family; to the two or three who may yet remember me at
Shiffnal; and, also, to Daniel, and desire him, when he gathers the
Easter dues, to give my love and thanks to all my parishioners.“[445]

No doubt Fletcher’s statement to Mr. York,


respecting himself, was strictly true; but, still, there
must have been a considerable improvement in his
health since he left England. Hence the following
interesting letter, written to Mr. Ireland only ten days
later:—
“Nyon, September 25, 1778.
“My Dear Friend,—I am just returned from an excursion I have
made with my brother, through the fine vale in the midst of the high
hills which divide France from this country. In that vale we found
three lakes, one on French ground, and two on Swiss: the largest is
six miles long and two wide. It is the part of the country where
industry is most apparent, and where population thrives best. The
inhabitants are chiefly woodmen, coopers, watchmakers, and
jewellers. They told me, they had the best singing, and the best
preacher, in the country. I asked, if any sinners were converted under
his ministry? They stared, and asked, what I meant by conversion?
When I had explained myself, they said, ‘We do not live in the time
of miracles.’
“I was better satisfied in passing through a part of the vale which
belongs to the King of France. I saw a prodigious concourse of
people, and supposed they kept a fair, but was agreeably surprised
to find three missionaries in the midst of them, who went about as
itinerant preachers to help the regular clergy. They had been there
some days, and were three brothers, and preached morning and
evening. The evening service opened with what they called a
conference. One of the missionaries took the pulpit, and the parish
priest proposed questions to him, which he answered at full length
and in a very edifying manner. The subject was the unlawfulness and
the mischief of those methods by which persons of different sexes
lay snares for each other, and corrupt each other’s morals. The
subject was treated with delicacy, propriety, and truth. The method
was admirably well calculated to draw and fix the attention of a
mixed multitude. This conference being ended, another missionary
took the pulpit. His text was our Lord’s description of the day of
judgment. Before the sermon, all those who, for the press, could
kneel, did, and sang a French hymn to beg a blessing on the word;
and indeed it was blessed. An awful attention was visible upon most,
and, during a good part of the discourse, the voice of the preacher
was almost lost in the cries and bitter wailings of the audience. When
the outcry began, the preacher was describing the departure of the
wicked into eternal fire. They urged that God was merciful, and that
Jesus Christ had shed His blood for them. ‘But that mercy you have
slighted, and now is the time of justice. That blood you have trodden
under foot, and now it cries for vengeance. Know your day. Slight the
Father’s mercy and the Son’s blood no longer.’ I have seen but once
or twice congregations as much affected in England.
“One of our ministers being ill, I ventured, a second time, into the
pulpit last Sunday; and, the Sunday before, I preached, six miles off,
to two thousand people in the yard of a jail, where they were come
to see a murderer before his execution. I was a little abused by the
bailiff on the occasion, and was refused the liberty of attending the
poor man to the scaffold, where he was to be broken on the wheel. I
hope he died penitent. The day before he suffered, he said he had
broken his irons, and that, as he deserved to die, he desired new
ones to be put on, lest he should be tempted to make his escape.
“You ask, what I design to do? I propose, if it be the Lord’s will, to
spend the winter here. In the spring, I shall, if nothing prevents,
return to England with you, or with Mr. Perronet, if his affairs are
settled, or alone, if other ways fail. In the meanwhile, I rejoice with
you in Jesus, and in the glorious hope of that complete salvation His
faithfulness has promised, and His power can never be at a loss to
bestow. We must be saved by faith and hope till we are saved by
perfect love, and made partakers of heavenly glory. I am truly a
stranger here. As strangers let us go where we shall meet the
assembly of the righteous gathered in Jesus.“[446]

Mr. William Perronet arrived at Nyon in the month


of December, and, in letters to his father, related:—
“However engaged Mr. Fletcher is the greater part of the day, he is
generally so kind as to spend a little time with me in the evening in
prayer and conversation. His chief delight seems to be in meeting his
little society of children. He is exceedingly fond of them, and they
appear to be as fond of him. He seldom walks abroad or rides out,
but some of them follow him, singing the hymns they have learned,
and conversing with him by the way. But you must not suppose that
he is permitted to enjoy this happiness unmolested. Not only do the
drunkards make songs on him and his little companions, but many of
the clergy loudly complain of such irregular proceedings. However, he
is upon good terms with three ministers of the place; all of whom are
serious men, and desirous of promoting true religion.
“He is better, I think, than when he left England; but he frequently
puts his strength to too severe a trial, by meeting his Society of
children, and some grown persons; and other exercises of a like
nature. When he ventures to preach, his spitting of blood returns;
and whenever this happens, his strength and spirits decay
surprisingly.”[447]

Fletcher and his brother translated all the papers of


William Perronet into French, and, in other ways,
assisted him, in reference to the estate which he had
gone to Switzerland to obtain. Notwithstanding the
delicate state of Fletcher’s health, the three set out,
in the wintry weather of that December month, to
visit Chateau d’Oex, where the property was situated.
The distance from Nyon was fifty-seven miles. When
they had made about a quarter of the journey, “the
horses were tired out, the coachman refused to
proceed further,” and they were obliged to return
[448]
home again. A few days later, they made another
attempt, and arrived at their destination on January
10, 1779. Five days afterwards, they were again at
Nyon.
In Fletcher’s state of health, such a journey was
perilous; but his love to the Perronet family was such
that, to him, no labour and risk, on their behalf, were
too great. In letters to his venerable father, at
Shoreham, William Perronet states, that none of
them having been to Chateau d’Oex before, they
were obliged to employ a guide, and that “on account
of the badness of the ways,” they had “to go some
leagues about,” which made their journey about
eighty miles. Their coach had to pass “over
mountains of snow and rocks of ice.” When nine
miles from Chateau d’Oex, they were obliged to
exchange their coach for “an open sledge;” and now
they “travelled through narrow passes, cut through
the snow, which, on both sides, was many feet above
their heads; on the sides of mountains, whose
summits the eye could scarcely reach; and frequently
on the brink of precipices, at the bottoms of which
they could hear the waters roar like thunder.” In one
place, Fletcher and William Perronet, being obliged to
walk, their feet slipped: Fletcher “received a violent
blow on the back part of the head;” and William
Perronet “sprained” his “wrist.” In crossing the Alps,
they had to lie “two nights in beds that were not only
damp, but musty and without curtains;” and, “being
in a Popish canton, and Friday and Saturday being
meagre days,” they “were almost starved with hunger
as well as cold.” “The weather was extremely severe,
and it was scarce in the power of clothes, or even of
fire, to keep” them “warm.” William Perronet
concludes his narrative of their adventures as follows:

“Whether I succeed in my temporal business or not, I shall ever
remember, with pleasure and thankfulness, the opportunities I have
been blessed with in spending so much time in company with our
inestimable friend; who, wherever he goes, preaches the Gospel,
both by his words and example; nay, by his very looks, not only to
his friends, but to all whom he meets: so that, on the top of the
frozen Alps, and in the dreary vale of Chateau d’Oex, good seed has
been sown. At Chateau d’Oex, he was visited by some of the
principal inhabitants, who stood around him, in deep attention, for
almost an hour, while he exhorted and prayed.”[449]

In a postscript to this letter, Fletcher wrote:—


“I have had the pleasure of accompanying your son to your
father’s birthplace. It is a charming country for those who have a
taste for highland prospects; but what is it to our heavenly Father’s
Hill of Sion? Thither may we all travel, summer and winter, and there
may we all have a happy meeting, and find an eternal inheritance!”

Three weeks later, Fletcher wrote the following to


Mr. Ireland:—
“Nyon, February 2, 1779.
“My Dear Friend,—I am sorry to hear that you are still tried by
illness; but our good, heavenly Father is wise; His will be done; His
name be praised!
“I am better, thank God! and ride out every day, when the slippery
roads will permit me to venture without the risk of breaking my
horse’s legs and my own neck. You will ask me how I spend my
time? I pray, have patience, rejoice, and write, when I can; I saw
wood in the house when I cannot go out; and eat grapes, of which I
have always a basket by me.
“Our little Lord-Lieutenant has forbidden the ministers to let me
exhort in the parsonage, because it is the sovereign’s house. My
second brother has addressed a memorial to him, in which he
informs him that he will give up neither his religious nor civil liberty,
and will open his house for the Word of God. According, we have
since met at his house.
“On Sunday, we met at the young clergyman’s who writes against
the conduct of the clergy; but I fear we fence against a wall of brass.
However, I am quite persuaded that Providence calls me to leave a
testimony to my French brethren, and it may be of some use when I
shall be no more. I have been comforted by the apology of a minister
at Yverdon, who was persecuted at the beginning of this century
under the name of Pietist; and I have become acquainted with a
faithful minister of Geneva, but he dares no more offer me his pulpit
than my brother-in-law at Lausanne.
“Several young women seem to have received the Word in the love
of it, and four or five grown-up ones; but not one man, except the
young hopeful clergyman I mention, who helps me at my little
meetings, and begins to preach extempore. The truths I chiefly insist
upon, when I talk to the people who will hear me, are those which I
feed upon myself as my daily bread. ‘God, our Maker and Preserver,
though invisible, is here and everywhere. He is our chief good,
because all beauty and all goodness centre in and flow from Him. He
is especially love; and love in us, being His image, is the sum and
substance of all moral and spiritual excellence—of all true and lasting
bliss. In Adam we are all estranged from love and from God; but the
Second Adam—Jesus, Emanuel, God with us,—is come to make us
know and enjoy again our God as the God of love and the chief
good. All who receive Jesus receive power to become the sons of
God,’ etc., etc.
“I hope I shall be able to set out for England with Mr. Perronet, in
April or May. O that I may find that dear island in peace within and
without![450] Well, I hope you make peace in the Church if you cannot
make peace with the patriots.
“The coats and shoes you gave me have lasted all this while, and
are yet good; so that I need not draw upon your banker. Thank God,
and you, for a thousand favours! God bless and comfort you, my
dear friend! We are poor creatures, but we have a good God to cast
all our burdens upon, and who often burdens us that we may have
constant and free recourse to His bounty, power, and faithfulness.
Stand fast in the faith. Believe lovingly, and all will be well.”[451]

To his friend and Methodist helper among the


Madeley Societies, William Wase, Fletcher wrote as
follows:—
“Nyon, February 11, 1779.
“My Dear Friend,—I have just received yours of January 24, and
rejoice to hear of the welfare of your friends, whom I long much to
see; but there is no blessing here without some alloy of grief, and
such was to me the account of the poor state of health of dear Mrs.
Wase. Tell her I should be glad to hold up her hands in her fight of
affliction; but, if the poor, unprofitable, weak servant is afar off, the
Master, who is rich in mercy, who fills the whole world with His
goodness and patience, is near to her and to all His afflicted ones. I
recommend to her two remedies. One is a cheerful resignation to the
will of God, whereby her animal spirits will be greatly raised or
sweetly refreshed. The other is, four lumps of heavenly sugar, to be
taken every half hour, day and night, when she does not sleep. I
make a constant use of them, to my great comfort. They have
quickened my soul when I was dying, and I doubt not they will have
the same effect upon hers. They are: ‘God so loved the world,’ etc. ‘If
any man sin,’ etc. ‘It is a faithful saying,’ etc. ‘Come unto Me, all ye
that are weary,’ etc.
“Tell my little god-daughter, Patty Cartwright, she is big enough
and bad enough to take these heavenly pills. Tell her mother to take
them regularly with her. What a shame it is to have such a remedy
and not to make more use of it!
“Remember me in much love to dear Mr. Hatton. Thank brother
Costerdine and his fellow-labourer[452] for their occasional help. May
the Lord vouchsafe to consecrate our little Zoar[453] by calling one
sinner and establishing another saint! How abundantly shall we be
repaid for our little expense and trouble! Thank the brethren you
have mentioned; salute them kindly from me, not forgetting John
Tranter and our friends at the Fore Bank—Thomas Pool and Thomas
Banks, and our friends at Dawley Green. You may see in the
enclosed that I am not without hopes of telling you in May how much
I am yours,
“J. Fletcher.”[454]

“The enclosed” communication bore the same date


as this letter to William Wase, of Broseley, and was
addressed “To the Brethren in and about Madeley;”
i.e., the Methodists:—
“My Dear Companions in Tribulation,—Peace and mercy, faith, hope,
and love be multiplied to you all from the Father of mercies through
the Lord Jesus Christ, by the Spirit of grace! I thank you for your kind
remembrance of me in your prayers. I am yet spared to pray for you.
O that I had more power with God! I would bring down heaven into
all your hearts. Strive together in love for the living faith, the glorious
hope, the sanctifying love once delivered to the saints. Look to Jesus.
Move on; run yourselves in the heavenly race, and let each sweetly
draw his brother along, till the whole company appears before the
redeeming God in Sion.
“I hope God will, in His mercy, spare me to see you in the flesh;
and if I cannot labour for you, I shall gladly suffer with you. If you
will put health into my flesh, joy into my heart, and life into my
whole frame, be of one heart and of one soul. Count nothing your
own but your sin and shame; and bury that dreadful property in the
grave of our Saviour. Let all you are and have be His who bought
you. Dig hard in the Gospel mines for hidden treasure. Blow hard the
furnace of prayer with the bellows of faith until you are melted into
love, and the dross of sin is purged out of every heart. Get together
into Jesus, the heavenly ark, and sweetly sail into the ocean of
eternity; so shall you be true miners, furnacemen, and bargemen.
Farewell, in Jesus! Tell Mrs. Cound I shall greatly rejoice if she
remembers Lot’s wife.”[455]
Six weeks after the date of this letter to the
Madeley Methodists, Wesley visited them, and wrote:

“1779. March 25, Thursday. I preached in the new house which Mr.
Fletcher has built in Madeley Wood. The people here exactly
resemble those at Kingswood, only they are more simple and
teachable. But, for want of discipline, the immense pains which he
has taken with them has not done them the good which might have
been expected. I preached at Shrewsbury in the evening, and next
day, about noon, in the assembly-room at Broseley. It was well we
were in the shade, for the sun shone as hot as it usually does at
midsummer. We walked from thence to Coalbrook Dale, and took a
view of the bridge which is shortly to be thrown over the Severn. It is
one arch, a hundred feet long, fifty-two high, and eighteen wide; all
of cast-iron, weighing many hundred tons. I doubt whether the
Colossus at Rhodes weighed much more.”[456]

Fletcher’s health was still feeble, but he longed to


be back to his parishioners and to the Methodists
surrounding Madeley. Hence the following to the
Vicar of Shoreham:—
“1779, March 29. I am still weak in body, but able to ride out and
exhort some children. Well, the time shall come when, in a better
state, we shall be able to glorify our heavenly Father. In the
meantime, let us do it either in the stocks of weakness or in the fires
of tribulation; and on our death-bed may we sing, with hearts
overflowing with humble love, ‘The Resurrection and the Life, the
Friend and Saviour of sinners, loved me and gave Himself for me;
and I am going to see Him and to thank Him, face to face, for His
matchless love!’
“I hope the prospect respecting the inheritance of your fathers in
this country clears up a little, and I trust the matter will be decided
without a lawsuit. As soon as the affair is brought to some
conclusion, we design to set out for England. The will of the Lord be
done in all things!”[457]

This was written in the week before Easter. The


Puritanical Calvinists of Switzerland of course
denounced the observance of holy days, and hence,
at Nyon, there was no service on Good Friday, April
2; but Fletcher and William Perronet, who all their life
had been accustomed to commemorate the death of
the incarnate Son of God, crossed the lake into
Savoy, to hear a celebrated Capuchin.
“He made,” says Mr. Perronet, “a very good discourse, and he and
his brethren invited us to dine with them. This we declined; but, after
dinner, we paid our respects to them, when Mr. Fletcher spent two or
three hours with them in serious and friendly conversation.”[458]

Fletcher had expressed a hope that he would be


able to return to his flock at Madeley in April or May,
but his hope was not realized. The reasons for this
will be found in the following extracts from his letters.
To his curate, the Rev. Mr. Greaves, he said:—
“Nyon, May 18, 1779. My dear fellow-labourer,—My departure
being delayed some weeks gives me much concern, although, from
the confidence I have in your pastoral diligence, I am easy about the
flock you feed. Last week, a Visitation was held here, and the clergy
of the town took my part against the Visitor and others, who said I
was of a sect everywhere spoken against. The conversation about it
held so long, and was so trying to my grain of humility, that I went
out. The matter, however, ended peaceably by a vote that they
should invite me to dinner. God ever save us from jealous and
persecuting zeal.
“I hope, my dear friend, you go on comfortably, doing more and
more the work of an evangelist. Remember my love to as many of
my parishioners as you meet with, and especially to all our good
neighbours and to the Society.”[459]

On the same day, he wrote to Michael Onions as


follows:—
“I have complied with the request of my friends to stay a little
longer among them, as it was backed by a small Society of pious
people gathered here. Three weeks ago, they got about me, and on
their knees, with many tears, besought me to stay till they were a
little stronger and able to stand alone; nor would they rise till they
had got me to comply. However, yesterday, I spoke with a carrier,
from Geneva, to take me to London, who said he would take us at a
fortnight’s notice.
“My love to your fellow-leaders, and, by them, to the companies
you meet in prayer; also to the preachers who help in the
Round[460].”[461]

On May 22, William Perronet, in a letter to his


father, observed:—
“On the 9th of this month, Mr. Fletcher preached in the church, on
2 Cor. v. 20—‘We are ambassadors for Christ,’ etc. He spoke with a
strong and clear voice for more than three-quarters of an hour, and
did not find himself hurt by it. He has preached four times in the
church since I have been here, and might have preached much
oftener if his health would have allowed him; for, by his friendly and
prudent conduct towards the three ministers of the place, he is upon
good terms with them now, although, at his first coming hither, they
were afraid to own him, on account of his irregular conduct; for such
they deemed his exhorting the children, and holding meetings in
private houses.”[462]

On the same day, Fletcher remarked to the same


venerable minister:—
“My Very Dear Brother, and Honoured Father,—I rejoice that you are
yet preserved to be a witness of the grace and saving health of
Jesus. Let us rejoice that when our strength shall decay, His will
remain entire for ever, and, in His strength, we, who take Him for our
life, shall be strong. Our Redeemer liveth; and, when sickness and
death shall have brought down our flesh to the earth, we shall, by
His resurrection’s power, rise and live for ever with Him in heavenly
places; for the new earth will be a heaven, or a glorious province in
the kingdom of heaven. The meek shall inherit it; and that
inheritance will be fairer than yours at Chateau d’Oex, and surer too.
“I hope to accompany your son soon to England.”[463]

The following, also, was written at the same time,


and was addressed to his honoured host and friend,
Mr. Charles Greenwood, of Stoke Newington:—
“Nyon, May 22, 1779.
“My Dear Friend,—“I am yet alive, able to ride out, and now and
then to instruct a few children. I hope Mr. Perronet will soon have
settled his affairs, and then, please God, I shall inform you, by word
of mouth, how much I am indebted to you, Mrs. Greenwood and Mrs.
Thornton. Thank and salute, on my behalf, Mr. John and Mr. Charles
Wesley, Dr. Coke, and Mr. Atlay.[464] Thanks be to God for His
unspeakable gifts,—His Son, His Spirit, and His Word! And thanks be
to His people, for their kindness towards the poor, the sick, the
stranger, and especially towards me! But, at this time, a sleepless
night and a constant toothache unfit me for almost everything but
lying down under the cross, kissing the rod, and rejoicing in hope of
a better state, in this world or in the next. Perhaps weakness and
pain are the best for me in this world. Well, the Lord will choose for
me, and I fully set my heart and seal to His choice. Let us not faint in
the day of adversity. The Lord tries us, that our faith may be purged
of all the dross of self-will, and may work by that love, which beareth
all things, and thinketh evil of nothing. Our calling is to follow the
crucified, and we must be crucified with Him, until body and soul
know the power of His resurrection, and pain and death are done
away.
“I hope my dear friend will make, with me, a constant choice of
the following mottoes of St. Paul,—Christ is gain in life and death—
Our life is hid with Christ in God—If we suffer with Him, we shall also
reign with Him—We glory in tribulation—God will give us rest with
Christ in that day—We are saved by hope. To the Lord our God,
Creator, Redeemer, and Sanctifier, let us give glory in the fires.
Amen.”[465]

Besides his own physical weakness and suffering,


Fletcher had other trials in Switzerland. In a letter,
written about the same time as the foregoing, he
remarked:—
“Let us bear with patience the decays of nature; let us see, without
fear, the approach of death. We must put off this sickly, corruptible
body, in order to put on the immortal and glorious one. I have some
hopes that my poor sister will yet be my sister in Christ. Her self-
righteousness, I hope, breaks as fast as her body. I am come hither
to see death make havoc among my friends. I wear mourning for my
father’s brother, and for my brother’s son. The same mourning will
serve for my dying sister, if I do not go before her. She lies on the
same bed where my father and mother died, and where she and I
were born. How near is life to death! But, blessed be God, Christ, the
Resurrection, is nearer to the weak, dying believer!”[466]

Fletcher, notwithstanding his longing to get back to


his flock at Madeley, was still detained in Switzerland.
Hence the following, addressed to Mr. Thomas York:

“Nyon, Ibid..
“My Dear Sir,—Providence is still gracious to me, and raises me
friends on all sides. May God reward them all, and may you have a
double reward for all your kindness! I hope I am getting a little
strength. The Lord has blessed to me a species of black cherry,
which I have eaten in large quantities. I have had a return of my
spitting blood; but, for a fortnight past, I have catechized the
children of the town every day; and I do not find much
inconvenience from that exercise. Some of them seem to be under
sweet drawings of the Father, and a few of their mothers begin to
come, and desire me with tears in their eyes to stay in this country.
They urge much my being born here, and I reply, that I was born
again in England; that is, of course, the country which, to me, is the
dearer of the two.
“My friends have prevailed on me to publish ‘A Poem on the Praises
of God,’ which I wrote many years ago. The revising it for the press
is at once a business and a pleasure, which I go through on
horseback. Help me, by your prayers, to ask a blessing on this little
attempt.
“I wish I could procure you an estate in this fine country, as I hope
to do Mr. Perronet, one of the physicians who showed me so much
love when I lay sick at Newington. His grandfather was a Swiss, who
was naturalized in the reign of Queen Anne. By calling upon some of
his relations, I have found that he is entitled to an estate of some
£1000, of which he is come to take possession. So Providence
prepares for me a friend, a kind physician, and a fellow-traveller, to
accompany me back to England; where one of my chief pleasures
will be to embrace you, and to assure you, how much I am, my dear
friend, your obliged servant,
“J. Fletcher.”[467]
Alas! little did Fletcher think that William Perronet
would not return to England.
“Providence,” said Fletcher, in the letter just
quoted, “raises me friends on all sides.” He soon had
need of them. In the month of September, William
Perronet wrote:—
“Mr. Fletcher has been wont to preach, now and then, in the
church here (Nyon), at the request of one or other of the ministers;
but, some time ago, he was summoned before the Seigneur Bailiff,
who sharply reprehended him for preaching against Sabbath-
breaking and stage plays. The former, he said, implied a censure on
the magistrates in general, as if they neglected their duty. And the
latter he considered as a personal reflection on himself, he having
just then sent for a company of French Comedians to come to Nyon.
Accordingly, he forbade Mr. Fletcher to exercise, any more, any of the
functions of a minister in this country. However, one of the Ministers
here has given him a room in his own house to preach in; and here
Mr. Fletcher meets a few serious persons, particularly a number of
children, two or three times a week. Hitherto, his lordship has not
interfered with respect to this mode of exhortation; and both the
number and the seriousness of the congregation increase daily.”[468]

Referring to the same incident, Fletcher wrote:—


“Our Lord Lieutenant, being stirred up by some of the clergy, and
believing firmly that I am banished from England, took the alarm,
and forbade the ministers to let me exhort in their houses;
threatening them with the power of the Senate if they did. They all
yielded, but are now ashamed of it. A young clergyman, a true
Timothy, has opened me his house, where I exhort twice a week;
and the other clergymen, encouraged by his boldness, come to our
meetings.”
William Perronet completes this story by relating
that the minister, who began this discreditable
opposition, died suddenly, as he was dressing to go
to church; and that his successor continued the same
intolerant behaviour towards poor, well-meaning
Fletcher. Mr. Perronet adds:—
“Mr. Fletcher now thinks himself obliged, before he leaves his
native country, to bear a public testimony to the truth. When his
writing will be finished, I cannot say, for it multiplies under his fertile
pen; so that, I fear, we shall be obliged to spend another winter in
this severe climate.”[469]

There can be little doubt that the “public


testimony,” which Fletcher was now composing was
his “Portrait of St. Paul,” to be noticed anon.
Soon after this, Fletcher had an attack of
rheumatism, and wrote as follows to William
Perronet, who had gone to Lausanne. After relating
that the pain in his left shoulder had deprived him of
sleep, and almost crippled him, he added:—
“I have partly recovered the use of my shoulder; but it is still very
weak. I drink a decoction of pine-apple, which is as warm as
guaiacum. My writing does not go on; but the will of the Lord is
done, and that is enough. I would press you to come back soon, if I
were not persuaded you are better where you are. I have been afraid
that our bad meat here would make you lose your flesh; and, for the
honour of Switzerland, I should be glad you had some to carry back
to England, if we live to go and see our friends there. I had last
Sunday (December 19), a great trial in my family. I see the Lord will
not use me in this country for good, and, when we shall have
finished our little matters, I shall be glad to go to my spiritual friends,
and to my flock; so much the more, as Mr. Ireland mentions my
curate’s danger of being in a consumption. My compliments and
thanks wait on Miss Perronet. She was very obliging to share her
drops with me. May we all share the springs of grace and glory
together! If you will come a few leagues southward, and try the
weather here, your room waits for you, and I shall be glad to see
you. In the meantime, keep yourself warm by the Word of God
within, and a good fire without. The Lord direct us in all things! Oh
for quietness and English friends!”[470]

Two days after writing this, Fletcher addressed his


curate, Mr. Greaves, as follows:—
“Nyon, December 25, 1779.
“My Dear Brother,—Glory be to God for His unspeakable gift! May
that Jesus, that eternal, all-creating, all-supporting, all-atoning, all-
comforting Word, which was with God, and is God, and came, in the
likeness of sinful flesh, to dwell among men, and to be our
Emmanuel, God with us,—may He, by a lively faith, be formed in our
hearts; and, by a warm love, lie and grow in the manger of our
emptiness, filling it always with the bread that comes down from
heaven!
“Though absent in body, I am with you and the flock in spirit. You
are now at the Lord’s table. O may all the dear people, you have just
now preached to, receive Jesus in the pledge of His dying love, and
go home with this lively conviction, ‘God has given me eternal life,
and this life is in His Son!’
“Glory be to God in heaven! Peace on earth! Love and good-will
everywhere! Especially in the place where Providence has called us
to cry, ‘Behold! what manner of love the Father has testified to us, in
Jesus, that we, children of wrath, should be made children of God,
by that only-begotten Son of the Most High, who was born for our
regeneration, crucified for our atonement, raised for our justification,
and who now triumphs in heaven for our sanctification, for our full
redemption, and for our eternal glorification. To Him be glory for ever
and ever;’ and may all, who fear and love Him about you, say, for
ever, Amen! Hallelujah!
“Out of the fulness of my heart, I invite them to do so; but how
shallow is my fulness to His! What a drop, compared to an ocean
without bottom or shore! Let us, then, receive continually from Him,
who is the overflowing and ever-present source of pardoning,
sanctifying, and exhilarating grace; and, from the foot of the Wrekin,
where you are, to the foot of the Alps, where I am, let us echo back
to each other the joyful, thankful cry of the primitive Christians,
which was the text here this morning, ‘Out of His fulness, we have all
received grace for grace.’
“I long to hear from you and the flock. How do you go on? Let me
know that you cast joyfully all your burdens on the Lord. Mr. Ireland
sends me word, that Mr. Romaine told him you are not very well.
Take care of yourself. Lay nothing to heart. Should your breast be
weak, preach but once on Sundays; for you know the evening
sermon is not a part of our stated duty. I say this, that you may not
over-do, and lie by, as I do. God direct, sustain, and comfort you in
all things!
“Give my pastoral love to all my flock. May all see, and see more
abundantly, the salvation of God! May national distress be sanctified
unto them; and may they all be loyal subjects of the King of kings,
and of His Anointed, our King! May the approaching new year be to
them a year of peace and Gospel grace! I hope Molly takes good care
of you. God bless her!”[471]

Fletcher refers to the “national distress.” This was


great. Parliament was excited. Ireland was in a state
of veiled rebellion. England rang with reports of
threatened invasion. The war with the American
colonists had already added sixty-three millions to the
national debt. Trade was paralysed, and taxes were
intolerable. Popery had been established in Canada,
and had received encouragement in England. The
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like