100% found this document useful (1 vote)
39 views

Procedural Programming with PostgreSQL PL/pgSQL: Design Complex Database-Centric Applications with PL/pgSQL 1st Edition Baji Shaik instant download

The document provides information about the book 'Procedural Programming with PostgreSQL PL/pgSQL' by Baji Shaik and Dinesh Kumar Chemuduru, which focuses on designing complex database-centric applications using PL/pgSQL. It covers various aspects of PL/pgSQL, including its features, functionalities, and application scenarios, along with practical examples and best practices. The document also includes links to additional resources and related books on PostgreSQL and database programming.

Uploaded by

cwkclyxkz7757
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 (1 vote)
39 views

Procedural Programming with PostgreSQL PL/pgSQL: Design Complex Database-Centric Applications with PL/pgSQL 1st Edition Baji Shaik instant download

The document provides information about the book 'Procedural Programming with PostgreSQL PL/pgSQL' by Baji Shaik and Dinesh Kumar Chemuduru, which focuses on designing complex database-centric applications using PL/pgSQL. It covers various aspects of PL/pgSQL, including its features, functionalities, and application scenarios, along with practical examples and best practices. The document also includes links to additional resources and related books on PostgreSQL and database programming.

Uploaded by

cwkclyxkz7757
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/ 43

Procedural Programming with PostgreSQL PL/pgSQL:

Design Complex Database-Centric Applications


with PL/pgSQL 1st Edition Baji Shaik download

https://textbookfull.com/product/procedural-programming-with-
postgresql-pl-pgsql-design-complex-database-centric-applications-
with-pl-pgsql-1st-edition-baji-shaik/

Download full version ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Beginning PostgreSQL on the Cloud: Simplifying Database


as a Service on Cloud Platforms Baji Shaik

https://textbookfull.com/product/beginning-postgresql-on-the-
cloud-simplifying-database-as-a-service-on-cloud-platforms-baji-
shaik/

PostgreSQL for data architects discover how to design


develop and maintain your database application
effectively with PostgreSQL Maymala

https://textbookfull.com/product/postgresql-for-data-architects-
discover-how-to-design-develop-and-maintain-your-database-
application-effectively-with-postgresql-maymala/

Exam Ref Pl 900 Microsoft Power Platform Fundamentals


Craig Zacker

https://textbookfull.com/product/exam-ref-pl-900-microsoft-power-
platform-fundamentals-craig-zacker/

Complex Analysis with Applications 1st Edition Nakhlé


H. Asmar

https://textbookfull.com/product/complex-analysis-with-
applications-1st-edition-nakhle-h-asmar/
Elementary Logic with Applications A Procedural
Perspective for Computer Scientists 1st Edition D.M.
Gabbay

https://textbookfull.com/product/elementary-logic-with-
applications-a-procedural-perspective-for-computer-
scientists-1st-edition-d-m-gabbay/

PostgreSQL Server Programming - Second Edition Dar

https://textbookfull.com/product/postgresql-server-programming-
second-edition-dar/

Learning PostgreSQL 10 A beginner s guide to building


high performance PostgreSQL database solutions Juba

https://textbookfull.com/product/learning-
postgresql-10-a-beginner-s-guide-to-building-high-performance-
postgresql-database-solutions-juba/

SQL Server Database Programming With Visual Basic NET


Concepts Designs and Implementations Ying Bai

https://textbookfull.com/product/sql-server-database-programming-
with-visual-basic-net-concepts-designs-and-implementations-ying-
bai/

National Brands and Private Labels in Retailing First


International Symposium NB PL Barcelona June 2014 1st
Edition Juan Carlos Gázquez-Abad

https://textbookfull.com/product/national-brands-and-private-
labels-in-retailing-first-international-symposium-nb-pl-
barcelona-june-2014-1st-edition-juan-carlos-gazquez-abad/
Baji Shaik and Dinesh Kumar Chemuduru

Procedural Programming with


PostgreSQL PL/pgSQL
Design Complex Database-Centric Applications
with PL/pgSQL
Baji Shaik
Texas, TX, USA

Dinesh Kumar Chemuduru


Andhra Pradesh, India

ISBN 978-1-4842-9839-8 e-ISBN 978-1-4842-9840-4


https://doi.org/10.1007/978-1-4842-9840-4

© Baji Shaik and Dinesh Kumar Chemuduru 2023

This work is subject to copyright. All rights are solely and exclusively
licensed by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and
retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

The publisher, the authors, and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress
Media, LLC, part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
I extend this dedication to Afrah Razzak, my exceptional wife. Her
enduring support and remarkable patience during the extended writing
sessions have been invaluable to me.
—Baji Shaik
I lovingly extend this dedication to my dear friend, Baji Shaik. Your
unwavering support and encouragement have been my guiding light,
especially in the most challenging moments. Your belief in me has been a
constant source of inspiration, and I am grateful for your presence in my
journey. This book is as much a tribute to our friendship as it is a
testament to the power of steadfast camaraderie. Thank you for always
being there.
—Dinesh Kumar Chemuduru
Introduction
The PostgreSQL engine comes with its own dedicated procedural
language, similar to procedural languages found in other commercial
database engines. This language, known as PL/pgSQL, offers a range of
powerful features that developers have long desired. For instance,
PL/pgSQL includes certain object-oriented programming capabilities
like the ability to define custom operators and types, as well as custom
aggregates.
In contrast to other programming languages supported by
PostgreSQL, PL/pgSQL is intricately linked with the PostgreSQL
database engine interface. This tight integration ensures optimal
performance and a seamless fit for constructing business logic on the
database side. In this book, we not only introduce the fundamentals of
PL/pgSQL, but we also dive deep into specific use cases that we’ve
implemented for particular scenarios. Our aim is to comprehensively
cover the various features, functionalities, and application scenarios of
PL/pgSQL, offering assistance in crafting effective server-side objects
with ease.
Through the content of this book, you will gain an understanding of
PL/pgSQL’s design and dive deep into its transaction model, including
how commit and rollback operations function. You’ll discover strategies
for optimizing PL/pgSQL functions and procedures and explore the
mechanics of inline or anonymous server-side code, along with its
limitations. Furthermore, you’ll acquire insights into debugging and
profiling PL/pgSQL code and learn techniques for conducting statistical
analyses on the PL/pgSQL code you create.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub
(https://github.com/Apress). For more detailed information, please
visit https://www.apress.com/gp/services/source-code.
Acknowledgments
I would like to express my gratitude to several individuals who have
played a crucial role in making this book a reality. A heartfelt thank-you
to Apress Media for providing me with this valuable opportunity. I am
especially grateful to my coauthor and mentor, Dinesh Kumar
Chemuduru, for his exceptional collaboration. I want to express my
gratitude to Divya Modi and Nirmal Selvaraj for being understanding of
our hectic schedules and providing us with continuous support
throughout the entire process. Special thanks to Deepak Mahto for his
thorough review of the book. Lastly, I am profoundly thankful to my
parents, Lalu Saheb Shaik and Nasar Bee, whose unwavering support
has shaped me into the person I am today.

—Baji Shaik

I would like to extend my heartfelt gratitude to a remarkable group


of individuals who have been instrumental in making this endeavor a
reality. My heartfelt thank-you to Apress Media for providing me with
this valuable opportunity. A special note of appreciation to my
esteemed coauthor, Baji Shaik. Sincere thanks to Deepak Mahto, whose
meticulous review and insightful feedback significantly enhanced the
quality and depth of this manuscript. To Divya Modi and Nirmal
Selvaraj, our project coordinators, your organizational skills and
dedication ensured that every aspect of this project fell seamlessly into
place. To my parents Vanamma, Sreenivasulu and my dearest children,
Yashvi and Isha, and to the future luminaries, Hema Siri K and Rahul
Sonu K – your unwavering love and understanding throughout the
demanding phases of this project have served as my steadfast anchor.
Your continuous support is my driving force.
Finally, a heartfelt thank-you to my exceptional team at Tessell. Your
commitment to excellence and innovation is awe-inspiring. Together,
we are shaping the future of DBaaS, and I am privileged to work
alongside such talented individuals.
—Dinesh Kumar Chemuduru
Table of Contents
Chapter 1:​Introduction to PL/​pgSQL
A Closer Look at PL/​pgSQL
PL/​pgSQL Installation
PL/​pgSQL Execution Flow
PL/​pgSQL Blocks
Anonymous or Unnamed Blocks
Named Blocks
Summary
What’s Next
Chapter 2:​PL/​pgSQL Variables
What Are Variables in PL/​pgSQL?​
Declaring Variables
Variable Scope
Constant Variables
Variable Alias
Scalar Variables
Array Variables
Record Variables
Cursor Variables
Summary
What’s Next
Chapter 3:​PL/​pgSQL Data Types
Data Types
Declaring Variables with Data Types
Supported Types
Base Type
Composite Type
Domain Type
Pseudo-Type
Range Type
Multirange Types
Summary
What’s Next
Chapter 4:​Dealing with Strings, Numbers, and Arrays
Strings
Function Format
Dealing with Null String
Numbers
Arrays
Example Use Cases
Strings
Numbers
Arrays
Summary
What’s Next
Chapter 5:​Control Statements
IF/​ELSE Statement
Cascading IF Statements
CASE Statement
Iterative Statement
LOOP Statement
WHILE Statement
FOR Statement
Example Use Cases
Example 1
Example 2
Best Practices of Using Control Statements in PL/​pgSQL
Summary
What’s Next
Chapter 6:​Handling Arrays
Array Index
Array Length
Iterate Array
Find Duplicate Elements in Array
Append Elements to Array
Array Merge
Multidimensional​Arrays
Summary
What’s Next
Chapter 7:​Handling JSON
What Is JSON?​
Use Cases
Advantages and Disadvantages
Build PL/​pgSQL Functions for JSON
Indexing JSON Data
Other Useful JSON Functions
Summary
What’s Next
Chapter 8:​Cursors
What Are Cursors?​
CURSOR Attributes
ISOPEN Attribute
FOUND Attribute
NOTFOUND Attribute
ROWCOUNT Attribute
Monitor Cursors
SCROLL Cursor
NO SCROLL Cursor
WITH HOLD Cursors
Refcursors
Summary
What’s Next
Chapter 9:​Custom Operators
Built-In Operators
Creating a Custom Operator
Simple Example
SCENARIO 1:​Case-Insensitive Comparison
SCENARIO 2:​Custom Data Type Math
SCENARIO 3:​Date Differentiate Operator
SCENARIO 4:​Custom Operator for Data Classification
Advantages
Disadvantages
Summary
What’s Next
Chapter 10:​Custom Casting
Built-In Casts
Custom Casts
Creating a Custom Cast
Simple Example
SCENARIO 1:​Converting Custom Data Types
SCENARIO 2:​Custom Data Type to JSONB
Summary
What’s Next
Chapter 11:​Dynamic SQL
What Is Dynamic SQL?​
Syntax of Dynamic SQL in PL/​pgSQL
Simple Example
Use Cases of Dynamic SQL
Best Practices and Considerations for Dynamic SQL
1.​Preventing SQL Injection
2.​Sanitizing and Validating Inputs
3.​Security Concerns
4.​Performance Optimization
Summary
What’s Next
Chapter 12:​Building Functions and Procedures
Functions
Defining Functions
Calling Functions
Categories
Immutable Functions
STABLE Functions
VOLATILE Functions
Procedures
Temporary Functions/​Procedures
VARIADIC Functions/​Procedures
Best Practices
Summary
What’s Next
Chapter 13:​Return Values and Parameters
Return Values
Simple Example
Different Ways to Return Values
RETURNS
RETURNS SETOF
RETURNS TABLE
OUT
Simple Difference Matrix
Different Examples for Each RETURN Type
Using SELECT Statements
Using RETURNS TABLE
Using RETURN NEXT
Using RETURNS SETOF TABLE
Using RETURNS SETOF Data Type
Using RETURNS RECORD
Using RETURNS SETOF RECORD
Using OUT Parameters
Using INOUT Parameter
Summary
What’s Next
Chapter 14:​Handling Exceptions
Exceptions
GET DIAGNOSTICS
FOUND
Exceptions in PL/​pgSQL
Different Ways to Handle Exceptions in PL/​pgSQL
Using the BEGIN and END Statements
Using the RAISE Statement
Custom Exceptions
Rethrow Exceptions
ASSERT
Get Call Stack
Using the GET STACKED DIAGNOSTICS Statement
Advantages of Using Exceptions
Disadvantages of Using Exceptions
Summary
What’s Next
Chapter 15:​Triggers
What Are Triggers?​
Syntax
Simple Example
Another Random Scribd Document
with Unrelated Content
them, so that in our controversies with the pseudo-science of the
times there is nothing more important than to bring out clearly and
strongly the facts on which the certainty of the Christian faith rests.
This Father Jouin has done, and in his book we have the whole
groundwork on which Christianity is based spread out before us in
perspective; the outline is complete, though of course, in the
limited space which he allowed himself, he has not been able to
bring out each detail in full. Yet he assures us in his preface that
nothing essential has been left out, and we have verified his
assertion. Altogether this is just the sort of book, in our opinion,
that is needed to combat the errors of the age, and to serve as an
antidote to the poison of rank infidelity and materialism with which
the very atmosphere around us is charged.
The author tells us that he designs the work more especially as a
text-book for students in the higher classes of our Catholic colleges,
and we sincerely hope that it may be adopted in every Catholic
college throughout the country. Our Catholic instructors fully realize
the importance of giving their students a thorough grounding in the
evidences of their religion, and Father Jouin’s book in the hands of
a good professor can be made the basis of a thorough course of
such instruction.
Not alone to students in colleges do we recommend the study of
this work, but to every intelligent educated Catholic, who should
investigate the reasons on which his religion is founded, and be
able to answer for the faith that is in him. Let our Catholic lawyers
and doctors and business men take it up, and they will find in it
sufficient to convince them of the reasonableness of their creed. It
will furnish them, moreover, with conclusive arguments against the
absurd theories and false views of religion which are being
advanced every day in their hearing.
The greatest enemy that the Catholic Church has to contend
with, both without and within, at the present day, is ignorance of
her true position and teaching, and we eagerly invite and
encourage every study and investigation that may in any way help
to dispel it.
It is to be regretted that so valuable a work has not been brought
out in a worthy manner. It is neither well printed nor well put
together.

The New Vesper Hymn-Book: A companion to The New Vesper Psalter;


containing a collection of all the hymns sung at Vespers
throughout the year (classified according to metre), set to music,
either for unison or four voices, with accompaniment, and
including the best of the plain chant melodies, together with the
words in full, and the versicles and responses proper to each
hymn. The whole compiled and edited by Charles Lewis, Director
of the Cathedral Choir, Boston, Mass. Boston: Thos. B. Noonan &
Co.
At the present stage of the revival of Gregorian Chant, the true
song of the church, we can commend this little work as one which
will doubtless be found useful in many churches whose organists
are unable to harmonize the chant or the singers to read its proper
notation. We wish, however, that the editor had given all the hymns
as found in the Vesperale, as the musical airs which are substituted
are not worthy to supplant the original melodies. The style of
notation is that usually adopted in translations from the old form of
four lines and square notes. Could not the editor have done better,
so as to give to those unaccustomed to plain chant some idea of its
movement and expression? There is no mark given to designate
accented from unaccented notes, and, lacking this, we defy any one
who is not familiar with the traditional movement of a phrase to
give its true expression.
We think the spacing of notes and phrases as given in the old
style should be preserved—that is, the notes upon each syllable
should be printed close together, and a wider and distinct space left
between syllables and words. An intelligent system of writing plain
chant upon the modern musical staff is yet to be invented. We have
been told that in some places the Tonic Sol-Fa system is being
attempted, with what success we have not learned.

Lotos Flowers, gathered in Sun and Shadow. By Mrs. Chambers-


Ketchum. New York: D. Appleton & Co. 1877.
Mrs. Chambers-Ketchum is already known to the readers of The
Catholic World through her poems, “Advent” and “A Birthday Wish”
(appearing under the name of “Twenty-one” in the present
collection), published in its pages during the present year. Her verse
is pure in thought and written out of a woman’s heart full of love
and enthusiasm. With true Southern fervor she revels in the
luxuriant flora of her home, and in the landscape of all her pictures
she takes a dear delight. Even so unsightly an object as a
Mississippi steamboat-landing grows picturesque under her hand,
and do we not feel soft Italian air as we read?—

“Peaceful stand
The sentinel poplars in their gold-green plumes
Beside the Enzo bridge. Where late the hoofs
Of flying squadrons scared th’affrighted land
The soft cloud-shadows chase each other now
O’er violet gardens.”

As with many another poet, the ease with which Mrs. Chambers-
Ketchum writes is at times a snare, leading her to accept too readily
a hackneyed term or word, surrendering after too slight a struggle
to the tyranny of rhyme. In her verse, also, there is sometimes a
lack of smoothness that would set despair in the heart of the
faithful scanner.
Was it because our ears were sick with a certain slang of
“culture” that, when we stumbled over Krishna in the “Christian
Legend,” we felt a strong desire to banish these Indian immortals to
that Hades where languished the gods of Greece until Schiller called
them forth to run riot in the field of religion as well as of art? And is
not the term “legend” a strange misnomer, for the New Testament
narrative of the raising of Lazarus? For Mrs. Chambers-Ketchum’s
verse is essentially Christian and womanly, and even so short a
notice of it would scarcely be complete without a mention of
“Benny,” who, with his kitten and his “baby’s sense of right,” is
already dear and familiar to the mothers and children of our whole
country, whose kindly hearts will surely give to Benny’s mother their
sympathy in his loss.

Surly Tim, and Other Stories. By Francis Hodgson Burnett. New York:
Scribner, Armstrong & Co. 1877.
Unfortunately for our first impression of the merit of the little
volume of which “Surly Tim” is the initial story, we began our
reading with “Lodusky,” attracted to it by the locality of the tale, its
hill people and dialect being a loadstone to us, but lately returned
from similar surroundings. But as even in our mountain Edens we
find the trail of the serpent, so in “Lodusky” we seemed to be
treading the familiar path of moral irresponsibility and the tyranny
of personal magnetism, and we craved the flaming sword of the
archangel to put the evil to flight.
Nor did our impression grow fairer on turning to “Le Monsieur de
la Petite Dame.” But in “One Day at Arle” and in “Seth” we
welcomed truly the author’s strong and exquisite pathos. In these
pictures of the sorrow of the laboring classes the author draws with
a pencil full of feeling, working under a sky whose hue is the leaden
monotone of modern French landscape painting; a break of
sunshine here and there, but the light seems to fall, after all, on
earthly stubble and the dumb, almost soulless faces of patient
cattle that know nothing beyond their daily furrow and the mute,
faithful service they bear a kindly hand at the plough.
We are reminded of the pathos of Robert Buchanan’s North-Coast
verse, and we close the little volume sadly, almost as if all human
sorrow wherein is no Christian joy stood at our threshold, asking
from us an alms we had no power to give.

Repertorium Oratoris Sacri: Containing Outlines of Six Hundred


Sermons for all the Sundays and Holidays of the Ecclesiastical
Year; also for other solemn occasions. Compiled from the works
of eminent preachers of various ages and nations by a secular
priest. With an introduction by the Rt. Rev. Joseph Dwenger,
D.D., Bishop of Fort Wayne. New York and Cincinnati: Fr. Pustet,
Typographus Sedis Apostolicæ. 1877.
This publication is to be continued in monthly parts, each part
containing the outlines of two sermons for each Sunday and holiday
for one quarter of the year. There will be four volumes of four parts
each, so that when the work is completed there will be eight
sermons for each occasion.
It will, if it fulfils the promise of this first number, be the best and
most complete collection of the kind ever published so far as we are
aware. It hardly needs to be said that plans of sermons such as are
here given are very much more valuable to a preacher than the
actual sermons themselves; for there are few who can give with
much effect the words of another, to say nothing of the trouble
involved in committing them to memory. The sermons of great
pulpit orators are indeed extremely useful and deserving of study as
models of style; but a few will answer that purpose as well as a
thousand.
The work is in English, being designed principally for use in this
country. It is most earnestly to be hoped that it will receive the
liberal support which it certainly deserves.

Nicholas Minturn. A Study in a Story. By J. G. Holland. 1 vol. 12mo.


New York: Scribner, Armstrong & Co. 1877.
We prefer Dr. Holland’s stories to his essays. He possesses fine
descriptive powers; his genial humor captivates the reader; his
power of analysis is searching. No one can read Nicholas Minturn
without recognizing the author’s ability to lay bare the vices and
follies of the various classes with whom his hero is brought in
contact. In doing this, however, Dr. Holland is apt to forget their
redeeming virtues. This is his great fault as a novelist. He lacks the
power to vitalize the subtle traits that appeal to our humanity.
There is no bond of union between his people and us. He is unable
to centralize our interest. When disaster overtakes the ocean
steamer there is not a single figure to start out from the group and
wring a groan of compassion from us. We listen to the wailing of
despair and the shriek of terror with as much apathy as if it arose
from a distant battle-field. In all other respects the story is far
superior to the great mass of light literature.

The Eternal Years. By the Hon. Mrs. A. Montgomery, author of The


Divine Sequence, also The Bucklyn Shaig, Mine Own Familiar
Friend, The Wrong Man, On the Wing, etc. With an introduction
by the Rev. S. Porter, S.J. London: Burns & Oates. 1877.
The Eternal Years is a republication of a series of articles from
The Catholic World. A number of thoughtful readers of our
magazine have expressed the great interest with which they have
read those articles and their desire to know the name of the author.
They will be pleased to see that they are now published in a volume
under their author’s name. On the Wing will be remembered as
having been one of the most popular of the series of sketches
taken from scenes in European life and incidents of travel which we
have from time to time published. Mrs. Montgomery possesses a
very versatile talent as a writer, and passes with facility “from grave
to gay, from lively to severe.” Whatever she writes is always both
instructive and pleasing.

The Sunday-School Teacher’s Manual; or, The Art of Teaching


Catechism. For the use of teachers and parents. By the Rev. A.
A. Lambing, author of The Orphan’s Friend. New York: Benziger
Brothers. 1877.
Father Lambing has done for Sunday-school teachers what M.
Amond, the curé of St. Sulpice, and Father Porter have done for
those engaged in the sacred ministry of the pulpit.
This manual, written in a clear and popular style, supplies a need
that should have been more felt than it was. It gives those in
charge of Sunday-schools a true idea of their very important
mission, a deep sense of the responsibility that rests upon them,
points out the various qualifications necessary for the faithful
discharge of their duties, and contains many useful instructions
which will aid them in becoming effective catechisers.

Iza: A Story of Life in Russian Poland. By Kathleen O’Meara. London:


Burns & Oates. 1877. (New York: The Catholic Publication
Society Co.)
This book, by a lady who since its first appearance has become
distinguished in the higher walks of literature, has been republished
at a very seasonable time, when the Eastern war, and the novel
pretensions of Russia to be considered the friend and protector of
oppressed nationalities, have once more called public attention to
her barbarous treatment of the gallant Poles. The scenes are laid in
Poland; the characters, which are few and clearly drawn, are Polish
or Muscovite, and the plot, though simple and natural, is well and
artistically wrought out. The theme of the whole story is the
oppression of the Polish nobility by the shrewd, keen, and
unscrupulous agents of the czar, wherein the generous, high-
spirited and confiding patriotism of the one class is strongly
contrasted with the accomplished villainy of the other. Though the
superstructure is, of course, a work of pure fiction, it is based on
well known historical facts. The entire work is written with great
care and accuracy as to names, places, costumes, and local
customs, the situations are highly dramatic, and the moral effect
produced on the reader is healthful and salutary.
The Catholic World.
The attention of readers will be directed to the advertisement of
complete sets of The Catholic World and The Young Catholic as
suitable and valuable Christmas presents. Bound volumes of The
Young Catholic make the very best present that could be offered to
children. The reading matter is interesting, the illustrations are
really excellent, and the puzzles and charades afford unfailing
amusement for the long winter evenings.
The Catholic World is now in its twenty-sixth volume. It
constitutes a library, and a most valuable and varied library, in itself.
In it is everything that could be desired. Theology and philosophy
have their departments, filled by men of known and recognized
competence, master minds indeed in those higher sciences. The
literary articles and reviews are acknowledged by the secular press
to be unsurpassed in power, grace, and strength. The polemics of
the day find their true solution in The Catholic World, which has told
upon the non-Catholic mind in this country as no other magazine or
publication has been able to tell. There is an abundance of fiction
and light literature in its pages, a fiction that has known how to be
interesting without being dangerous, and good without being dull.
Many stories that have already made their mark in the literary world
and won deserved fame for their authors began by passing through
the columns of this magazine. All the leading and absorbing
questions of the day are taken up and discussed in it by men
thoroughly equipped and fitted for so important a task. Indeed The
Catholic World may fairly claim to be a channel through which the
very best Catholic literature of the day, in all its forms, passes, a
guide to and in all the questions of the day, and a compendium
from year to year of all that is best and most worthy of attention in
the higher sciences, in physical science, in politics, in literature, and
in art. His Eminence the Cardinal has recently kindly taken occasion
to “congratulate the Catholics in America on possessing a magazine
of which they may be justly proud,” and trusts “that they will
contribute their share to make The Catholic World still more useful
to themselves and to the Church at large.” No words could add
strength to this commendation and appeal; and it is to be hoped
that Catholics will take both to heart. No intelligent Catholic in this
country should be without a magazine that is peculiarly and
designedly his own. Yet are there thousands of intelligent persons
who are without it, who probably do not know of its existence. It is
for those who do know it and appreciate it to make it known among
their friends. Taken in the very lowest sense, no man has yet
complained that in The Catholic World he did not receive the full,
and more than the full, value of his money.
THE

CATHOLIC WORLD.
VOL. XXVI., No. 155.—FEBRUARY, 1878.

CEADMON THE COW-HERD, ENGLAND’S FIRST POET.

BY AUBREY DE VERE.
The Venerable Bede’s Ecclesiastical History of the English Nation contains
nothing more touching than its record of Ceadmon, the earliest English poet,
whose gift came to him in a manner so extraordinary. It occurs in the 24th
chapter: “By his verses the minds of many were often excited to despise the
world, and to aspire to heaven. Others after him attempted in the English nation
to compose religious poems, but none could ever compare with him; for he did
not learn the art of poetry from man, but from God, for which reason he never
would compose any vain or trivial poem.” ... “Being sometimes at entertainments,
when it was agreed, for the sake of mirth, that all present should sing in their
turns, when he saw the instrument come towards him he rose from the table and
retired home. Having done so on a certain occasion, ... a Person appeared to him
in his sleep, and, saluting him by his name, said, ‘Ceadmon, sing some song for
me.’ He answered, ‘I cannot sing.’” Ceadmon’s song is next described: “How he,
being the Eternal God, became the author of all miracles, Who first, as Almighty
Preserver of the human race, created heaven for the sons of men, as the roof of
the house, and next the earth.” ... “He sang the Creation of the world, the origin
of man, and all the history of Genesis, ... the Incarnation, Passion, Resurrection
of our Lord, and His Ascension.”[158] Ceadmon’s poetry is referred to also in
Sharon Turner’s History of the Anglo-Saxons; and Sir Francis Palgrave points out
the singular resemblance of passages in Paradise Lost to corresponding passages
in its surviving fragments. To the history of Ceadmon Montalembert has devoted
some of the most eloquent paragraphs in his admirable work, Les Moines
d’Occident—see chapter ii., vol. iv., page 68.
Sole stood upon the pleasant bank of Esk
Ceadmon the Cow-herd, while the sinking sun
Reddened the bay, and fired the river-bank
With pomp beside of golden Iris lit,
And flamed upon the ruddy herds that strayed
Along the marge, clear-imaged. None was nigh:—
For that cause spake the Cow-herd, “Praise to God!
He made the worlds; and now, by Hilda’s hand
He plants a fair crown upon Whitby’s height:
Daily her convent towers more high aspire;
Daily ascend her Vespers. Hark that strain!”
He stood and listened. Soon the flame-touched herds
Sent forth their lowings, and the cliffs replied,
And Ceadmon thus resumed: “The music note
Rings through their lowings dull, though heard by few!
Poor kine, ye do your best! Ye know not God,
Yet man, his likeness, unto you is God,
And him ye worship with obedience sage,
A grateful, sober, much-enduring race
That o’er the vernal clover sigh for joy,
With winter snows contend not. Patient kine,
What thought is yours, deep-musing? Haply this—
‘God’s help! how narrow are our thoughts, and few!
Not so the thoughts of that slight human child
Who daily drives us with her blossomed rod
From lowland valleys to the pails long-ranged!’
Take comfort, kine! God also made your race!
If praise from man surceased, from your broad chests
That God would perfect praise, and, when ye died,
Resound it from yon rocks that gird the bay:
God knoweth all things. Let that thought suffice!”

Thus spake the ruler of the deep-mouthed kine:


They were not his; the man and they alike
A neighbor’s wealth. He was contented thus:
Humble he was in station, meek of soul,
Unlettered, yet heart-wise. His face was pale;
Stately his frame, though slightly bent by age:
Slow were his eyes, and slow his speech, and slow
His musing step; and slow his hand to wrath,
A massive hand, but soft, that many a time
Had succored man and woman, child and beast;
Ay, yet could fiercely grasp the sword! At times
A i htil it l t h d hi h d
As mightily it clutched his ashen goad
When like an eagle on him swooped some thought:
Then stood he as in dream, his pallid front
Brightening like eastern sea-cliffs when a moon
Unrisen is near its rising.

Round the bay Meantime with deepening eve full many a fire Up-
sprung, and horns were heard. Around the steep With bannered
pomp and many a dancing plume Ere long a cavalcade made way.
Whence came it? Oswy, Northumbria’s king, the foremost rode,
Oswy triumphant o’er the Mercian host, To sue for blessing on his
sceptre new; With him an Anglian prince, student long time In
Bangor of the Irish, and a monk Of Gallic race far wandering from
the Marne: They came to look on Hilda, hear her words Of far-
famed wisdom on the Interior Life: For Hilda thus discoursed: “True
life of man Is life within: inward immeasurably The being winds of
all who walk the earth; But he whom sense hath blinded nothing
knows Of that wide greatness: like a boy is he That clambers round
some castle’s wall extern In search of nests—the outward wall of
seven— Yet nothing knows of those great courts within, The hall
where princes banquet, or the bower Where royal maidens touch
the lyre and lute, Much less its central church, and sacred shrine
Wherein God dwells alone.”[159] Thus Hilda spake; And they that
gazed upon her widening eyes Low whispered, each to each, “She
speaks of things Which she hath seen and known.”
On Whitby’s crest The royal feast was holden: far below, A noisier
revel dinned the shore; therein The humbler guests partook. Full
many a tent Glimmered upon the white sands, ripple-kissed; Full
many a savory dish sent up its steam; The farmer from the field
had driven his calf; The fisher brought the harvest of the sea; And
Jock, the woodsman, from his oaken glades The tall stag, arrow-
pierced. In gay attire Now green, now crimson, matron sat and
maid: Each had her due: the elder, reverence most, The lovelier
that and love. Beside the board The beggar lacked not place.
When hunger’s rage, Sharpened by fresh sea-air, was quelled, the
jest Succeeded, and the tale of foreign lands; But, boast who might
of distant chief renowned, His battle-axe, or fist that felled an ox,
The Anglian’s answer was “our Hilda” still: “Is not her prayer
puissant as sworded hosts? Her insight more than wisdom of the
seers? What birth like hers illustrious? Edwin’s self, Dëira’s exile,
next Northumbria’s king, Her kinsman was. Together bowed they
not When he of holy hand, missioned from Rome, Paulinus, poured
o’er both the absolving wave And knit to Christ? Kingliest was she,
that maid Who spurned earth-crowns!” The night advanced, he rose
That ruled the feast, the miller old, yet blithe, And cried, “A song!”
So song succeeded song, For each man knew that time to chant his
stave, But no man yet sang nobly. Last the harp Made way to
Ceadmon, lowest at the board: He pushed it back, answering, “I
cannot sing:” Around him many gathered clamoring, “Sing!” And
one among them, voluble and small, Shot out a splenetic speech:
“This lord of kine, Our herdsman, grows to ox! Behold, his eyes
Move slow, like eyes of oxen!”
Sudden rose
Ceadmon, and spake: “I note full oft young men
Quick-eyed, but small-eyed, darting glances round
Now here, now there, like glance of some poor bird,
That light on all things and can rest on none:
As ready are they with their tongues as eyes;
But all their songs are chirpings backward blown
On winds that sing God’s song, by them unheard:
My oxen wait my service: I depart.”
Then strode he to his cow-house in the mead,
Displeased though meek, and muttered, “Slow of eye!
My kine are slow: if I were swift my hand
Might tend them worse.” Hearing his steps the kine
Turned round their hornèd foreheads: angry thoughts
Went from him as a vapor. Straw he brought,
And strewed their beds; and they, contented well,
Down laid ere long their great bulks, breathing deep
Amid the glimmering moonlight. He, with head
Propped on the white flank of a heifer mild,
Rested, his deer-skin o’er him drawn. Hard days
Bring slumber soon. His latest thought was this:
“Though witless things we are, my kine and I,
Yet God it was who made us.”

As he slept,
Beside him stood a Man Divine and spake;
“Ceadmon, arise, and sing.” Ceadmon replied,
“My Lord, I cannot sing, and for that cause
Forth from the revel came I. Once, in youth,
I willed to sing the bright face of a maid,
And failed, and once a gold-faced harvest-field,
And failed, and once the flame-eyed face of war,
And failed once more.” To him the Man Divine,
“Those themes were earthly. Sing!” And Ceadmon said,
“What shall I sing, my Lord?” Then answer came,
“Ceadmon, stand up, and sing thy song of God.”

At once obedient, Ceadmon rose, and sang,


And help was with him from great thoughts of old
Within his silent nature yearly stored,
That swelled, collecting like a flood that bursts
In spring its icy bar. The Lord of all
He sang; that God beneath whose hand eterne,
Then when he willed forth-stretched athwart the abyss
Then when he willed forth-stretched athwart the abyss,
Creation like a fiery chariot ran,
Inwoven wheels of ever-living stars.
Him first he sang. The builder, here below,
From fair foundations rears at last the roof,
But Song, a child of heaven, begins with heaven,
The archetype divine, and end of all,
More late descends to earth. He sang that hymn,
“Let there be light, and there was light”; and lo!
On the void deep came down the seal of God
And stamped immortal form. Clear laughed the skies,
While from crystalline seas the strong earth brake,
Both continent and isle; and downward rolled
The sea-surge summoned to his home remote.
Then came a second vision to the man
There standing ‘mid his oxen. Darkness sweet,
He sang, of pleasant frondage clothed the vales,
Ambrosial bowers rich-fruited which the sun,
A glory new-created in his place,
All day made golden, and the moon by night
Silvered with virgin beam, while sang the bird
Her first of love-songs on the branch first-flower’d—
Not yet the lion stalked. And Ceadmon sang
O’er-awed, the Father of all humankind
Standing in garden planted by God’s hand,
And girt by murmurs of the rivers four,
Between the trees of Knowledge and of Life,
With eastward face. In worship mute of God,
Eden’s Contemplative he stood that hour,
Not her Ascetic, since, where sin is none,
No need for spirit severe.

And Ceadmon sang


God’s Daughter, Adam’s Sister, Child, and Bride,
Our Mother Eve. Lit by the matin star,
That nearer drew to earth, and brighter flashed
To meet her gaze, that snowy Innocence
Stood up with queenly port. She turned: she saw
Earth’s King, mankind’s great Father. Taught by God,
Immaculate, unastonished, undismayed,
In love and reverence to her Lord she drew,
And, kneeling, kissed his hand: and Adam laid
That hand, made holier, on that kneeler’s head,
And spake; “For this shall man his parents leave,
p ; p ,
And to his wife cleave fast.”

When Ceadmon ceased


Thus spake the Man Divine: “At break of day
Seek thou some prudent man, and say that God
Hath loosed thy tongue; nor hide henceforth thy gift.”
Then Ceadmon turned, and slept among his kine
Dreamless. Ere dawn he stood upon the shore
In doubt: but when at last o’er eastern seas
The sun, long wished for, like a god upsprang,
Once more he found God’s song upon his mouth
Murmuring high joy; and sought a prudent man,
And told him all the vision. At the word
He to the Abbess with the tidings fled,
And she made answer, “Bring me Ceadmon here.”

Then clomb the pair that sea-beat mount of God


Fanned by sea-gale, nor trod, as others used,
The curving way, but faced the abrupt ascent,
And halted not, so worked in both her will,
Till now between the unfinished towers they stood
Panting and spent. The portals open stood:
Ceadmon passed in alone. Nor ivory decked,
Nor gold, the walls. That convent was a keep
Strong ’gainst invading storm or demon hosts,
And naked as the rock whereon it stood,
Yet, as a church, august. Dark, high-arched roofs
Slowly let go the distant hymn. Each cell
Cinctured its statued saint, the peace of God
On every stony face. Like caverned grot
Far off the western window frowned: beyond,
Close by, there shook an autumn-blazoned tree:
No need for gems beside of storied glass.

He entered last that hall where Hilda sat


Begirt with a great company, the chiefs
Down either side far ranged. Three stalls, cross-crowned,
Stood side by side, the midmost hers. The years
Had laid upon her brows a hand serene,
And left alone their blessing. Levelled eyes
Sable, and keen, with meditative strength
Conjoined the instinct and the claim to rule;
Firm were her lips and rigid. At her right
Sat Finan Aidan’s successor with head
Sat Finan, Aidan s successor, with head
Snow-white, and beard that rolled adown a breast
Never by mortal passion heaved in storm,
A cloister of majestic thoughts that walked,
Humbly with God. High in the left-hand stall
Oswy was throned, a man in prime, with brow
Less youthful than his years. Exile long past,
Or deepening thought of one disastrous deed,
Had left a shadow in his eyes. The strength
Of passion held in check looked lordly forth
From head and hand: tawny his beard; his hair
Thick-curled and dense. Alert the monarch sat
Half turned, like one on horseback set that hears,
And he alone, the advancing trump of war.
Down the long gallery strangers thronged in mass,
Dane or Norwegian, huge of arm through weight
Of billows oar-subdued, with stormy looks
Wild as their waves and crags; Southerns keen-browed;
Pure Saxon youths, fair-fronted, with mild eyes
(These less than others strove for nobler place),
And Pilgrim travel-worn. Behind the rest,
And higher-ranged in marble-arched arcade,
Sat Hilda’s sisterhood. Clustering they shone,
White-veiled, and pale of face, and still and meek,
An inly-bending curve, like some young moon
Whose crescent glitters o’er a dusky strait.
In front were monks dark-stoled: for Hilda ruled,
Though feminine, two houses, one of men:
Upon two chasm-divided rocks they stood,
To various service vowed, though single. Faith;
Nor ever, save at rarest festival,
Their holy inmates met.

“Is this the man


Favored, though late, with gift of song?” Thus spake
Hilda with placid smile. Severer then
She added: “Son, the commonest gifts of God
He counts his best, and oft temptation blends
With powers more rare. Yet sing! That God who lifts
The violet from the grass as well could draw
Music from stones hard by. That song thou sang’st,
Sing it once more.”

Then Ceadmon from his knees


Arose and stood. With princely instinct first
The strong man to the abbess bowed, and next
To that great twain, the bishop and the king,
Last to that stately concourse ranged each side
Down the long hall; and, dubious, answered thus:
“Great Mother, if that God who sent the song
Vouchsafe me to recall it, I will sing;
But I misdoubt it lost.” Slowly his face
Down-drooped, and all his body forward bent
As brooding memory, step by step, retracked
Its backward way. Vainly long time it sought
The starting-point. Then Ceadmon’s large, soft hands
Opening and closing worked; for wont were they,
In musings when he stood, to clasp his goad,
And plant its point far from him, thereupon
Propping his stalwart weight. Customed support
Now finding not, unwittingly those hands
Reached forth, and on Saint Finan’s crosier-staff
Settling, withdrew it from the old bishop’s grasp;
And Ceadmon leant thereon, while passed a smile
Down the long hall to see earth’s meekest man
The spiritual sceptre claim of Lindisfarne.
They smiled; he triumphed: soon the Cow-herd found
That first fair corner-stone of all his song;
Then rose the fabric heavenward. Lifting hands,
Once more his lordly music he rehearsed,
The void abyss at God’s command forth-flinging
Creation like a Thought:—where night had reigned,
The universe of God.

The singing stars


Which with the Angels sang when earth was made
Sang in his song. From highest shrill of lark
To ocean’s deepest under cliffs low-browed,
And pine-woods’ vastest on the topmost hills,
No tone was wanting; while to them that heard
Strange images looked forth of worlds new-born,
Fair, phantom mountains, and, with forests plumed,
The marvelling headlands, for the first time glassed
In waters ever calm. O’er sapphire seas
Green islands laughed. Fairer, the wide earth’s flower,
Eden, on airs unshaken yet by sighs
From bosom still inviolate forth poured
Immortal sweets With sense to spirit turned
Immortal sweets. With sense to spirit turned
Who heard the song inhaled those sweets. Their eyes
Flashing, their passionate hands and heaving breasts,
Tumult self-stilled, and mute, expectant trance,
’Twas these that gave their bard his twofold might,
That might denied to poets later born
Who, singing to soft brains and hearts ice-hard,
Applauded or contemned, alike roll round
A vainly-seeking eye, and, famished, drop
A hand clay-cold upon the unechoing shell,
Missing their inspiration’s human half.

Thus Ceadmon sang, and ceased. Silent awhile


The concourse stood (for all had risen), as though
Waiting from heaven its echo. Each on each
Gazed hard and caught his hands. Fiercely ere long
Their gratulating shout aloft had leaped
But Hilda laid her finger on her lip,
Or provident lest praise might stain the pure,
Or deeming song a gift too high for praise.
She spake: “Through help of God thy song is sound:
Now hear His Holy Word, and shape therefrom
A second hymn, and worthier than the first.”

Then Finan stood, and bent his hoary head


Above the Scripture tome in reverence stayed
Upon his kneeling deacon’s hands and brow,
And sweetly sang five verses, thus beginning,
“Cum esset desponsata,” and was still;
And next rehearsed them in the Anglian tongue:
Then Ceadmon took God’s Word into his heart,
And ruminating stood, as when the kine,
Their flowery pasture ended, ruminate;
And was a man in thought. At last the light
Shone from his dubious countenance, and he spake:
“Great Mother, lo! I saw a second Song!
T’wards me it came; but with averted face,
And borne on shifting winds. A man am I
Sluggish and slow, that needs must muse and brood;
Therefore that Scripture till the sun goes down
Will I revolve. If song from God be mine
Expect me here at morn.”

The morrow morn


In that high presence Ceadmon stood and sang
A second song, and manlier than his first;
And Hilda said, “From God it came, not man;
Thou therefore live a monk among my monks,
And sing to God.” Doubtful he stood—“From youth
My place hath been with kine; their ways I know,
And how to cure their griefs.” Smiling she answered,
“Our convent hath its meads, and kine; with these
Consort each morning: night and day be ours.”
Then Ceadmon knelt, and bowed, and said, “So be it”:
And aged Finan, and Northumbria’s king
Oswy, approved; and all that host had joy.

Thus in that convent Ceadmon lived, a monk,


Humblest of all the monks, save him that slept
In the next cell, who once had been a prince.
Seven times a day he sang God’s praises, first
When earliest dawn drew back night’s sable veil
With trembling hand, revisiting the earth
Like some pale maid that through the curtain peers
Round her sick mother’s bed, misdoubting half
If sleep lie there, or death; latest when eve
Through nave and chancel stole from arch to arch,
And laid upon the snowy altar-step
At last a brow of gold. From time to time,
By ancient yearnings driven, through wood and vale
He tracked Dëirean or Bernician glades
To holy Ripon, or late-sceptred York,
Not yet great Wilfred’s seat, or Beverley:—
The children gathered round him, crying, “Sing!”
They gave him inspiration with their eyes,
And with his conquering music he returned it.
Oftener he roamed that strenuous eastern coast
To Yarrow and to Wearmouth, sacred sites,
The well-beloved of Bede, or northward more,
To Bamborough, Oswald’s keep. At Coldingham
His feet had rest—there where St. Ebba’s Cape
That ends the lonely range of Lammermoor,
Sustained for centuries o’er the wild sea-surge
In region of dim mist and flying bird,
Fronting the Forth, those convent piles far-kenned,
The worn-out sailor’s hope.

Fair English shores,


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!

textbookfull.com

You might also like