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

Get Procedural Programming with PostgreSQL PL/pgSQL: Design Complex Database-Centric Applications with PL/pgSQL 1st Edition Baji Shaik free all chapters

Applications

Uploaded by

quartzkliki
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)
44 views

Get Procedural Programming with PostgreSQL PL/pgSQL: Design Complex Database-Centric Applications with PL/pgSQL 1st Edition Baji Shaik free all chapters

Applications

Uploaded by

quartzkliki
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/ 55

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Procedural Programming with PostgreSQL PL/pgSQL:


Design Complex Database-Centric Applications with
PL/pgSQL 1st Edition Baji Shaik

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

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

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/

textboxfull.com

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/
textboxfull.com

Exam Ref Pl 900 Microsoft Power Platform Fundamentals


Craig Zacker

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

textboxfull.com

Complex Analysis with Applications 1st Edition Nakhlé H.


Asmar

https://textbookfull.com/product/complex-analysis-with-
applications-1st-edition-nakhle-h-asmar/

textboxfull.com
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/

textboxfull.com

PostgreSQL Server Programming - Second Edition Dar

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

textboxfull.com

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/

textboxfull.com

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/

textboxfull.com

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/
textboxfull.com
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
Types of Triggers in PostgreSQL
Row-Level Triggers
INSTEAD OF Triggers
Statement-Level Triggers
Event Triggers
Advantages of Triggers
Disadvantages of Triggers
DROP Triggers
Summary
What’s Next
Chapter 16:​Transaction Management
Nested Transactions
Exception Handling
Summary
What’s Next
Chapter 17:​Aggregates
Custom Aggregate
Simple Example
State Transition Function
Final Function
Creating Custom Aggregate
Create Type
Create State Transition Function
Create Aggregate
Final Function
Summary
What’s Next
Chapter 18:​Listen and Notify
Simple Example
Build Polling in psql
TCN Extension
Summary
What’s Next
Chapter 19:​PL/​pgSQL Essential Extensions
plprofiler Extension
Installation
Usage
plpgsql_​check Extension
Installation
Usage
Summary
Index
About the Authors
Baji Shaik
, currently serving as a Senior Database
Consultant at AWS Professional Services,
embarked on his journey into the world
of databases in 2011. Since then, his
expertise has encompassed an array of
database technologies, including Oracle,
PostgreSQL, EDB Postgres, Amazon RDS,
Amazon Aurora, Amazon Redshift, and
Greenplum. Baji’s extensive background
spans both depth and breadth,
showcasing his mastery in SQL/NoSQL
database technologies.
Baji stands out as a Database
Migration Expert, having successfully
developed numerous database solutions
that tackle complex business challenges,
particularly in migrating databases from on-premises environments to
Amazon RDS and Aurora PostgreSQL/MySQL. His prowess also extends
to performance optimization, having fine-tuned RDS/Aurora
PostgreSQL/MySQL databases to achieve remarkable performance
benchmarks.
With a passion for knowledge sharing, Baji has authored several
notable books on PostgreSQL, such as PostgreSQL Configuration,
Beginning PostgreSQL on the Cloud, and PostgreSQL Development
Essentials. His commitment to education and information
dissemination is further evident through his contributions to
conferences, workshops, and a multitude of insightful blogs within the
AWS blog community.

Dinesh Kumar Chemuduru


, an accomplished Principal Architect (OSS), brings a wealth of
experience to the realm of technology and open source solutions. With
a notable background at AWS as a
proficient database consultant, Dinesh
excelled in orchestrating numerous
successful database migrations. His
expertise extends to the open source
arena, where he has both crafted and
augmented solutions around
PostgreSQL, showcasing his commitment
to collaborative innovation.
A coding enthusiast at heart, Dinesh
finds joy in crafting applications using
Flutter, Golang, and C++, platforms
where his creativity knows no bounds.
His proficiency extends to the deployment phase, as he deftly navigates
Kubernetes to bring his coding creations to life. In the literary domain,
Dinesh stands as a coauthor of the esteemed PostgreSQL High
Performance Cookbook, a testament to his mastery of the subject matter.
Beyond his own works, he actively engages in the appraisal of fellow
authors’ PostgreSQL books, cementing his status as a valued participant
in the exchange of knowledge.
Dinesh’s impact reverberates through his open source
contributions, which include the inception and enrichment of projects
such as PTOR – an ingenious RPO/RTO/SLA calculator tailored for
PostgreSQL. Another tool, “hammerpost,” sets a benchmark for
synthetic parameter evaluation in PostgreSQL, seamlessly integrated
with HammerDB.
About the Technical Reviewer
Deepak Ramnandan Mahto
works as a PostgreSQL Database
Engineer at Google Cloud. He has been
working with PostgreSQL since 2018,
and he also worked as a database
migration consultant at AWS. He is also a
keen blogger and loves to publish
articles on migration, best practices, and
on cloud with PostgreSQL. He loves to
code and build database-related utilities
using PL/pgSQL and SQL.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2023
B. Shaik, D. K. Chemuduru, Procedural Programming with PostgreSQL PL/pgSQL
https://doi.org/10.1007/978-1-4842-9840-4_1

1. Introduction to PL/pgSQL
Baji Shaik1 and Dinesh Kumar Chemuduru2
(1) Texas, TX, USA
(2) Andhra Pradesh, India

In this chapter, we will start with an introduction of PL/pgSQL, on what is


PL/pgSQL and what are the key features of it. We will talk about some
common use cases where PL/pgSQL is used. PL/pgSQL comes by default
when you install the PostgreSQL server. However, we will provide the
steps to install PL/pgSQL. We will explain how PL/pgSQL works with a
simple flow diagram. We will show some basic examples of PL/pgSQL
code blocks which are called anonymous and named code blocks.

A Closer Look at PL/pgSQL


PostgreSQL uses SQL (Structured Query Language) as a default query
language. SQL is a common domain-specific language for relational
databases. PostgreSQL uses some extensions and features to implement
the standards of SQL. In addition to SQL, PostgreSQL supports many
procedural languages like PL/pgSQL, PL/Java, PLV8, PL/Python, PL/Perl,
etc. Using these languages, you can create functions, stored procedures,
and triggers which will improve the performance by reducing the
multiple iterations to the databases.
PL/pgSQL is the most commonly used procedural language in
PostgreSQL. It is an extension of SQL. It is similar to Oracle's PL/SQL and
supports features like control structures, exception handling, variables,
loops, and conditional statements. These features help us to develop
complex database applications in an efficient way.
When working on designing a complex business logic inside the
database, you would need to develop multiple SQLs which are sometimes
interdependent. Results of one SQL will be used by other SQLs. In this
case, running multiple SQLs increases the data flow between the database
and the client application and will cause performance bottlenecks due to
high data transfer through the network. To overcome this, you can use
stored procedures or functions.
PL/pgSQL supports stored procedures, functions, and triggers. A
stored procedure is a set of precompiled SQL statements which can be
executed repeatedly. Stored procedures can help to reduce network traffic
and improve performance by reducing the amount of data that needs to
be sent between the database and the client application.
The common use cases to use stored procedures or functions using
PL/pgSQL are
1. Improve data processing speed by using precompiled code through
stored procedures which will be faster than raw SQL queries.

2. Write more complex code using features like control structures,


exception handling, variables, loops, conditional statements, etc.

3. Using stored procedures or functions, you can create a reusable code


to call from the applications to save time and effort.

4. PL/pgSQL is portable across different operating systems and


platforms. This makes it easier to migrate code between different
environments.

5. Prevent unauthorized access and data breaches by controlling the


user authentication on stored procedures or functions.

6. Use triggers to implement constraints of business processes that


cannot be expressed as foreign keys or check constraints.

PL/pgSQL Installation
PL/pgSQL is already included in PostgreSQL, so if you have PostgreSQL
installed, you should have PL/pgSQL as well. However, you may need to
enable it if it is not already enabled. Here are the steps to enable
PL/pgSQL in PostgreSQL:
1. Install PostgreSQL psql client to connect to the database, or you can
use the pgAdmin client tool.
For Ubuntu, the following are the simple steps to install the client:
# Create the file repository configuration:

sudo sh -c 'echo "deb


http://apt.postgresql.org/pub/repos/apt
$(lsb_release -cs)-pgdg main" >
/etc/apt/sources.list.d/pgdg.list'

# Import the repository signing key:

wget --quiet -O -
https://www.postgresql.org/media/keys/ACCC4CF8.asc
| sudo apt-key add -

# Update the package lists:

sudo apt-get update

# Install the latest version of PostgreSQL. If you want a specific


version, use 'postgresql-12' or similar instead of 'postgresql':

sudo apt-get -y install postgresql-client-15

For Linux (RHEL), you can follow the steps here:


www.postgresql.org/download/linux/redhat/

2. Connect to the database and check if PL/pgSQL is already installed:

postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
-----+---------+--------+-------------
(0 rows)
postgres=# select * from pg_extension where
extname='plpgsql';
oid | extname | extowner | extnamespace |
extrelocatable | extversion | extconfig |
extcondition
----+---------+----------+--------------+---------
-------+------------+-----------+--------------
(0 rows)

3. Execute the following command to enable PL/pgSQL:

postgres=# CREATE EXTENSION plpgsql;


CREATE EXTENSION

4. Verify that PL/pgSQL is enabled by executing the following command:

postgres=# \dx
List of installed extensions
Name | Version
| Schema | Description
------ -+---------+------------+------------------
------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL
procedural language
(1 row)
JavaScript
postgres=# select * from pg_extension where
extname='plpgsql';
oid | extname | extowner | extnamespace |
extrelocatable | extversion | extconfig |
extcondition
------+---------+----------+--------------+-------
---------+------------+-----------+-------------
16388 | plpgsql | 10 | 11 |
f | 1.0 | |
(1 row)
PL/pgSQL Execution Flow
PL/pgSQL is like every other “loadable, procedural language.” PL/pgSQL
gets loaded through a function manager called fmgr. The fmgr loads the
language handler when a procedural language function or procedure is
executed and calls it. The execution flow of PL/pgSQL code is similar to
that of other procedural programming languages, with parsing,
compilation, execution, and cleanup stages. However, PL/pgSQL code is
executed on the server side, which means that it has direct access to the
database and can perform database operations more efficiently than
client-side code.
On the first call of a PL/pgSQL function or procedure in a session, the
server first parses the code to check for syntax errors. The call handler
will “compile” a function statement tree once the code is parsed. When
the code is compiled, it turns into an internal form that the server can
execute more efficiently. SQL queries in the function are just kept as a
string at this point, and the expressions like the following are actually
SQL queries:

my_var := some_param * 10

The SQL queries are actually parsed at this point, and parser hooks
are used to replace variables/parameters with PARAM nodes in the parse
tree. The PL/pgSQL statement tree is very similar to a PostgreSQL
execution tree. After the parse and compile, the call handler then executes
that statement tree. On the first execution of a statement node that has an
SQL query in it, that query is prepared via the Server Programming
Interface (SPI). The SPI provides a simple and efficient way to execute
SQL commands, retrieve query results, and manipulate the database. The
compiled code is then executed by the server. Based on any variable and
control structure declaration, the server creates a new execution
environment for the PL/pgSQL code. If the PL/pgSQL code is a function or
stored procedure that returns a result set, the server will send the result
set back to the client. Once the execution of the code is complete, the
server will clean up any resources that were used by the PL/pgSQL code,
including variables and any temporary tables that were created.
Figure 1-1 represents the flow of execution.
Figure 1-1 PL/pgSQL execution flow
This diagram illustrates the high-level steps of the PL/pgSQL
execution flow. However, it's important to note that PL/pgSQL code can
be quite complex and may include multiple control structures, error
handling blocks, and nested and even recursive PL/pgSQL function calls
and trigger invocations and database operations. The actual execution
flow of a specific PL/pgSQL function or stored procedure will depend on
the specific code and logic used. This call hierarchy is not limited to
PL/pgSQL. All procedural languages share the common entry point of the
fmgr, so they can be mixed and matched in trigger and function call
stacks.

PL/pgSQL Blocks
PL/pgSQL is a block-structured language. The basic unit in any PL/pgSQL
code is a block. All PL/pgSQL code is composed of a single block or blocks
that occur either sequentially or nested within another block. There are
two kinds of blocks:
Anonymous or unnamed blocks (DO)
Named blocks (functions)

Anonymous or Unnamed Blocks


Anonymous or unnamed blocks are generally constructed dynamically
and executed only once by the user. It is sort of a complex SQL statement.
The following is the structure of an anonymous block, for example:

DO $$
[ <<label>> ]
[ DECLARE
-- Variable declaration here
]
BEGIN
-- Execute statements here
END [ label ];
$$;

Now, let us start with a simple hello world code block, which does not
have any name associated with it:

postgres=# DO
$$
BEGIN
RAISE NOTICE 'Hello World';
END;
$$;
NOTICE: Hello World
DO
In the preceding example, the RAISE NOTICE command will help
us to print the given message on the client console. As you can see here,
the block is declared without a name, and if you want to print Hello
World, then you have to repeat the same set of instructions again.
Now, let us print the Hello World line by line rather than in a single
line:

postgres=# DO
$o$
BEGIN
RAISE NOTICE $i$
Hello
World
$i$;
END;
$o$;

NOTICE:
Hello
World
DO

In the preceding example, we used different multiline specifiers. The


whole block got enclosed by $o$, and the inner Hello World got
enclosed by $i$. From this example, we can learn that in PL/pgSQL, we
can have the nested multiliners, where each multiline should follow its
own enclosure.
Now, let us write a nested BEGIN ... END inside a main BEGIN
... END block. Here is an example:

postgres=# DO
$$
BEGIN

BEGIN
RAISE NOTICE 'Hello World';
Other documents randomly have
different content
absent in Myxinoids, but the gastric branches of the Vagus are
continued, united as a single nerve, along the intestine to the anus.
No fish possesses a Nervus accessorius. Also a separate Nervus
hypoglossus (twelfth pair)[13] is absent, but elements from the first
spinal nerve are distributed in the area normally supplied by this
nerve in higher vertebrates.

The number of Spinal nerves corresponds to that of the vertebræ,


through or between which they pass out. Each nerve has two roots,
an anterior and posterior, the former of which has no ganglion, and
exclusively contains motor elements. The posterior or dorsal has a
ganglionic enlargement, and contains sensory elements only. After
leaving the vertebral canal each spinal nerve usually divides into a
dorsal and ventral branch. The Gadoids show that peculiarity that
each of the posterior roots of some or many of the spinal nerves
possesses two separate threads, each of which has a ganglion of its
own; the one of these threads joins the dorsal and the other the
ventral branch. In fishes in which the spinal chord is very short, as in
Plectognaths, Lophius, the roots of the nerves are extremely long,
forming a thick Cauda equina. The additional function which the
(five) anterior spinal nerves of Trigla have to perform in supplying the
sensitive pectoral appendages and their muscles has caused the
development of a paired series of globular swellings of the
corresponding portion of the spinal chord. A similar structure is found
in Polynemus.
Fig. 46.
Brain and anterior portion of the
spinal chord of Trigla
(Gurnard), showing the
globular swellings at the
base of the anterior spinal
nerves.
A Sympathic nervous system appears to be absent in
Branchiostoma, and has not yet been clearly made out in
Cyclostomes. It is well developed in the Palæichthyes, but without
cephalic portion. This latter is present in all Osseous fishes, in which
communication of the Sympathic has been found to exist with all
cerebral nerves, except the olfactory, optic, and acustic. The
sympathic trunks run along each side of the aorta and the back of
the abdomen into the hæmal canal; communicate in their course with
the ventral branches of each of the spinal nerves; and, finally, often
blend together into a common trunk beneath the tail. At the points of
communication with the cerebral and spinal nerves frequently
ganglia are developed, from which nerves emerge which are
distributed to the various viscera.
CHAPTER VII.

THE ORGANS OF SENSE.

Characteristic of the Organ of Smell in Fishes is that it has no


relation whatever to the respiratory function, with the exception of the
Dipnoi, in which possibly part of the water received for respiration
passes through the nasal sac.
The olfactory organ is single in Branchiostoma and the
Cyclostomes. In the former a small depression on the front end of
the body, clothed with a ciliated epithelium, is regarded as a
rudimentary organ of smell. In the adult Petromyzon a membranous
tube leads from the single opening on the top of the head into the
cartilaginous olfactory capsule, the inside of which is clothed by
membranes prolonged into a posterior blind tube (Fig. 30, s), which
penetrates the cartilaginous roof of the palate, but not the mucous
membrane of the buccal cavity. In the Myxinoids the outer tube is
strengthened by cartilaginous rings like a trachea; the capsule is
lined by a longitudinally folded pituitary membrane, and the posterior
tube opens backwards on the roof of the mouth; the opening is
provided with a valve.
In all other Fishes the organ of smell is double, one being on
each side; it consists of a sac lined with a pituitary membrane, and
without, or with one or two, openings. The position of these openings
is very different in the various orders or suborders of Fishes.
In the Dipnoi the nasal sac opens downwards by two wide
openings which are within the boundaries of the cavity of the mouth.
The pituitary membrane is transversely folded, the transverse folds
being divided by one longitudinal fold. The walls of the sac are
strengthened by sundry small cartilages.
Also in Chondropterygians the openings, of which there is one to
each sac, are on the lower part of the snout, and in the Rays,
Holocephali, and some Sharks, each extends into the cleft of the
mouth. The openings are protected by valvular flaps, supported by
small cartilages, and moved by muscles, whence it may be
concluded that these fishes are able to scent (actively) as well as to
smell (passively).

Fig. 47.—Nostrils of Raia lemprieri,


with nasal flaps reverted.
In the majority of Teleostei the olfactory capsules are lateral or
superior on the snout, covered externally by the skin, each usually
pierced by two openings, which are either close together, or more or
less remote from each other; the posterior is generally open, the
anterior provided with a valve or tube. In the Chromides and
Labroidei ctenoidei a single opening only exists for each sac. In the
Murænidæ the two openings of each side are either superior, or
lateral, or labial, that is, they are continued downwards and pierce
the margin of the upper lip. In many Tetrodonts nasal openings are
absent, and replaced by a conical papilla, in which the olfactory
nerve terminates.
It is certain that fishes possess the faculty of perceiving odours,
and that various scents attract or repel them. A mangled carcase or
fresh blood attracts Sharks as well as the voracious Serrasal
monoids of the South American rivers. There is no reason to doubt
that the seat of that perception is in the olfactory sac; and it may be
reasonably conjectured that its strength depends mainly on the
degree of development indicated by the number and extent of the
interior folds of the pituitary membrane.
Organ of Sight.—The position, direction, and dimensions of the
eyes of fishes vary greatly. In some they have an upward aspect,
and are often very close together; in others they are lateral, and in a
few they are even directed downwards. The Flat-fishes represent the
extraordinary anomaly that both eyes are on the same side of the
head, and rarely on the same level, one being generally placed more
forward than the other. In certain species of marine fishes the eyes
are of an extraordinary size, a peculiarity indicating that the fish
either lives at a great depth, to which only a small proportion of the
rays of light penetrate, or that it is of nocturnal habits. In fishes which
have descended to such great depths that no rays whatever can
reach them, or in freshwater fishes living in caves, or in species
which grovel and live constantly in mud, the eyes are more or less
aborted, sometimes quite rudimentary, and covered by the skin. In
very few this organ appears to be entirely absent. In some Gobioids
and Trachinoids (Periophthalmus, Boleophthalmus, Uronoscopus,
etc.) the eyes, which are on the upper side of the head, can be
elevated and depressed at the will of the fish. In the range of their
vision and acuteness of sight, Fishes are very inferior to the higher
classes of Vertebrates, yet at the same time it is evident that they
perceive their prey or approaching danger from a considerable
distance; and it would appear that the visual powers of a
Periophthalmus, when hunting insects on mud-flats of the tropical
coasts, are quite equal to that of a frog. Again, the discrimination
with which fishes sometimes prefer one colour or kind of artificial fly
to another affords sufficient evidence that the vision, at least of
certain species is by no means devoid of clearness and precision.
The eye of Branchiostoma is of the most rudimentary condition. It
is simply a minute speck coated by dark pigment, and receiving the
end of a short nerve. In Myxinoids the minute rudiment of the eye is
covered by the skin and muscles. This is also the case in many of
the blind Teleosteous fishes; however, whilst in the former fishes the
organ of sight has not attained to any degree of development, the
rudimentary eye of blind Teleostei is a retrogressive formation, in
which often a lens and other portions of the eye can be recognised.
In fishes with a well-developed eye it is imbedded in a layer of
gelatinous and adipose substance, which covers the cavity of the
orbit. A lacrymal gland is absent. In the orbit of one fish only,
Chorismodentex, an organ has been found which can be compared
to a saccus lacrymalis. It is a round, blind, wide sac, of the size of a
pea, situated below the anterior corner of the orbit, between the
maxillary bone and the muscles of the cheek, communicating by a
rather wide foramen with the orbital cavity. The membrane by which
it is formed is continuous with that coating the orbita. In the
Chondropterygians the eyeball is supported by and moves on a
cartilaginous peduncle of the orbital wall. In the majority of
Teleosteans, and in Acipenser, a fibrous ligament attaches the
sclerotic to the wall of the orbit. The proper muscles of the eyeball
exist in all fishes, and consist of the four Musculi recti and the two M.
obliqui. In many Teleostei the former rise from a subcranial canal, the
origin of the M. rectus externus being prolonged farthest backwards.
The Recti muscles are extraordinarily long in the Hammerheaded
Sharks, in which they extend from the basis cranii along the lateral
prolongations of the head to the eyes, which are situated at the
extremities of the hammer.
In all fishes the general integument of the head passes over the
eye, and becomes transparent where it enters the orbit; sometimes it
simply passes over the orbit, sometimes it forms a circular fold. The
anterior and posterior portions may be especially broad and the seat
of an adipose deposit (adipose eyelids), as in Scomber, Caranx,
Mugil, etc. In many of these fishes the extent of these eyelids varies
with the seasons; during the spawning season they are so much
loaded with fat as nearly to hide the whole eye. Many Sharks
possess a nictitating membrane, developed from the lower part of
the palpebral fold, and moved by a proper set of muscles.
Fig. 48.
Vertical section through eye of
Xiphias. (After Owen.)
co, Cornea; sc, sclerotica; o, nervus
opticus; c, sclerotic capsule; a,
membrana argentea; v,
membrana vasculosa; u,
membrana uvea; ch, choroid
gland; r, retina; f, processus
falciformis; h, humor vitreus; l,
lens; i, iris.

The form of the bulbus (Fig. 48) is subhemispherical, the cornea


(co) being flat. If it were convex, as in higher Vertebrates, it would be
more liable to injury; but being level with the side of the head the
chances of injury by friction are diminished. The sclerotica (sc) is
cartilaginous in Chondropterygians and Acipensers, fibrous and of
varying thickness in Teleosteans, in the majority of which it is
supported by a pair of cartilaginous or ossified hemispheroid cups
(c). In a few fishes, as in Ceratodus, Xiphias, the cups are confluent
into one cup, which possesses a foramen behind to allow the
passage of the optic nerve (o). The cornea of Anableps shows an
unique peculiarity. It is crossed by a dark horizontal stripe of the
conjunctiva, dividing it into an upper and lower portion; also the iris is
perforated by two pupils. This fish is observed to swim frequently
with half of its head out of the water, and it is a fact that it can see
out of the water as well as in it.
The membranes situated between the sclerotica and retina are
collectively called choroidea, and three in number. The one in
immediate contact with the sclerotic, and continued upon the iris, is
by no means constantly present; it is the membrana argentea (a),
and composed of microscopical crystals reflecting a silvery or
sometimes golden lustre. The middle layer is the membrana
vasculosa s. halleri (v), the chief seat of the ramifications of the
choroid vessels; the innermost layer is the membrana ruyscheana or
uvea (u), which is composed of hexagonal pigment-cells, usually of a
deep brown or black colour.
In many Teleostei a rete mirabile surrounds the entry of the optic
nerve; it is situated between the membrana argentea and vasculosa,
and called the choroid gland (ch). It receives its arterial blood from
the artery issuing from the pseudobranchia; the presence of a
choroid gland always being combined with that of a pseudobranchia.
Teleosteans without pseudobranchia lack a choroid gland. In the
Palæichthyes, on the other hand, the pseudobranchia is present and
a choroid gland absent.
The iris (i) is merely the continuation of the choroid membrane; its
capability of contracting and expanding is much more limited than in
higher Vertebrates. The pupil is generally round, sometimes
horizontally or vertically elliptical, sometimes fringed. In the Rays and
Pleuronectidæ a lobe descends from the upper margin of the pupil,
and the outer integument overlying this lobe is coloured and non-
transparent; a structure evidently preventing light from entering the
eye from above.
In most Teleostei a fold of the Choroidea, called the Processus
falciformis (f), extends from the vicinity of the entrance of the optic
nerve to the lens. It seems to be constantly absent in Ganoids.
The retina (r) is the membrane into which the optic nerve
penetrates, and in which its terminal filaments are distributed. It
consists of several layers (Fig. 49). The outermost is an extremely
delicate membrane (a), followed by a layer of nerve-cells (b), from
which the terminal filaments issue, passing through several granular
strata (c, d, e), on which the innermost stratum rests. This stratum is
composed of cylindrical rods (f) vertically arranged, between which
twin fusiform corpuscles (g) are intercalated. This last layer is thickly
covered with a dark pigment. The retina extends over a portion of the
iris, and a well-defined raised rim runs along its anterior margin.

Fig. 49.—Vertical section of


the Retina of the Perch, magn. X
350.
The vitreous humour (Fig. 48, h) which fills the posterior cavity of
the eyeball, is of a firmer consistency than in the higher Vertebrates.
The lens is spherical, or nearly so; firm, denser towards the centre,
and lies in a hollow of the vitreous humour. When a falciform process
is present, it is with one end attached to the lens, which is thus
steadied in its position. It consists of concentric layers consisting of
fibres, which in the nucleus of the body have marginal teeth, by
which they are interlocked together. In Petromyzon this serrature is
absent, or but faintly indicated.

Fig. 50.—Interlocking fibres of lens,


highly magnified.
The anterior cavity of the eye is very small in Fishes, in
consequence of the small degree of convexity of the cornea; the
quantity of the aqueous humour, therefore, is very small, just
sufficient to float the free border of the iris; and the lessened
refractive power of the aqueous humour is compensated by the
greater convexity of the lens.

Organ of Hearing.—No trace of an organ of hearing has been


found in Branchiostoma. In the Cyclostomes the labyrinth is
enclosed in externally visible cartilaginous capsules laterally
attached to the skull; it consists of a single semicircular canal in the
Myxinoids, whilst the Petromyzontes possess two semicircular
canals with a vestibulum.
In all other fishes the labyrinth consists of a vestibule and three
semicircular canals, the vestibule dilating into one or more sacs
which contain the otoliths. A tympanum, tympanic cavity, and
external parts, are entirely absent in the class of fishes.
In the Chondropterygians and Dipnoi, the labyrinth is enclosed in
the cartilaginous substance of the skull. In the former the excavation
in the cartilage is larger than the membranous labyrinth, but nearly
corresponds to it in form; the part which receives the membranous
vestibulum is called Vestibulum cartilagineum, from which a canal
issues and penetrates to the surface of the skull, where it is closed
by the skin in Sharks, but opens by a minute foramen in Rays. The
otolithic contents are soft and chalklike.
In the Holocephali part of the labyrinth is enclosed in the cartilage
of the skull, another part being in the cranial cavity, as in Ganoids
and Teleosteans. The membranous vestibulum is continued by a
canal to a single opening in the roof of the skull, from which two
smaller canals are continued to two small foramina in the skin
covering the occipital region.
In the Teleosteans the sac which contains the otoliths lies on
each side of the base of the cranial cavity and is often divided by a
septum into two compartments of unequal size, each containing a
firm and solid otolith; these bodies (Fig. 51), possess indented
margins, frequently other impressions and grooves, in which nerves
from the N. acusticus are lodged; they vary much in size and form,
but in both respects show a remarkable constancy in the same kind
of fishes. The vestibule is outwards in contact with the osseous side
wall of the skull, inwards with the metencephalon and medulla
oblongata; it contains another firm concretion, and opens by five
foramina into the three semicircular canals. The terminations of the
acustic nerve are distributed over the vestibular concretion and the
ampulliform ends (Fig. 52 p) of the semicircular canals, without being
continued into the latter, which are filled with fluid. The semicircular
canals (Fig. 52 g), are sometimes lodged in the cranial bones,
sometimes partly free in the cranial cavity. Many Teleostei have
fontanelles in the roof of the skull, closed by skin or very thin bone
only at the place where the auditory organ approaches the surface,
by which means sonorous undulations must be conducted with
greater ease to the ear.

Fig. 51.—Otolith of Haddock (Gadus


æglefinus). I. Outer, II. Inner aspect.
In many Teleostei a most remarkable relation obtains between
the organ of hearing and the air-bladder. In the most simple form this
connection is established in Percoids and the allied families, in which
the two anterior horns of the air-bladder are attached to fontanelles
of the occipital region of the skull, the vestibulum occupying the
opposite side of the membrane by which the fontanelle is closed.
The condition is similar, but more complicated in many Clupeoids.
The anterior narrow end of the air-bladder is produced into a canal at
the base of the skull, and divided into two very narrow branches,
which again bifurcate and terminate in a globular swelling. An
appendage of the vestibulum meets the anterior of these swellings,
and comes into close contact with it. Besides, the two vestibules
communicate with each other by a transverse canal, crossing the
cranial cavity below the brain.
Fig. 52.—Communication between auditory organ and air-bladder in the Carp.
(After E. H. Weber.)
a, Basisphenoid; b, Occipital; c, Supraoccipital; d, Exoccipital; e, Paroccipital; f,
Alisphenoid; g, Neural arch of first vertebra; h, i, k, second, third, and fourth
vertebra; h’, i’, Parapophyses of second and third vertebra; i", process of the
third vertebra for the attachment of the air-bladder; k, l, m, Chain of ossicles;
n, Air-bladder; o, vestibulum; p, p, Ampullæ; q, q, Canales semicirculares; r,
Sinus impar.
The connection is effected by means of a chain of ossicles in
Siluridæ, Characinidæ, Cyprinidæ and Gymnotidæ. A canal issues
from the communication between vestibule and its sac, and meeting
that from the other side forms with it a common sinus impar (Fig. 52,
r), lodged in the substance of the basi-occipital; this communicates
on each side by a small orifice with two subspherical atria, on the
body of the atlas, close to the foramen magnum. Each atrium is
supported externally by a small bone (m); a third larger bone (k)
completes the communication with the anterior part of the air-
bladder. From the sinus impar a bifid canal penetrates into the
alisphenoids, in which it terminates. In Cobitis and several Loach-like
Siluroids the small air-bladder consists of two globular portions
placed side by side, and wholly included within two bullæ, formed by
the modified parapophyses of the second and third vertebræ. The
three ossicles on each side are present, but concealed by the fore
part of the osseous bulla.

Organ of Taste.—Some fishes, especially vegetable feeders, or


those provided with broad molar-like teeth, masticate their food; and
it may be observed in Carps and other Cyprinoid fish, that this
process of mastication frequently takes some time. But the majority
of fish swallow their food rapidly, and without mastication, and
therefore we may conclude that the sense of taste cannot be acute.
The tongue is often entirely absent, and even when it exists in its
most distinct state, it consists merely of ligamentous or cellular
substance, and is never furnished with muscles capable of producing
the movements of extension or retraction as in most higher
Vertebrates. A peculiar organ on the roof of the palate of Cyprinoids,
is perhaps an organ adapted for perception of this sense; in these
fishes the palate between and below the upper pharyngeal bones is
cushioned with a thick, soft contractile substance, richly supplied
with nerves from the Nervi vagus and glossopharyngeus.
Organs of Touch.—The faculty of touch is more developed than
that of taste, and there are numerous fishes which possess special
organs of touch. Most fishes are very sensitive to external touch,
although their body may be protected by hard horny scales. They
perceive impressions even on those parts which are covered by
osseous scutes, in the same manner as a tortoise perceives the
slightest touch of its carapace. The seat of the greatest
sensitiveness, however, appears to be the snout and the labial folds
surrounding the mouth. Many species possess soft and delicate
appendages, called barbels, which are almost constantly in action,
and clearly used as organs of touch. Among the Triglidæ and allied
families, there are many species which have one or more rays of the
pectoral fin detached from the membrane, and supplied with strong
nerves. Such detached rays (also found in the Polynemidæ,
Bathypterois) are used partly for locomotion, partly for the purpose of
exploring the ground over which the fish moves.
Some fish appear to be much less sensitive than others, or at
least lose their sensitiveness under peculiar circumstances. It is well
known that a Pike, whose mouth has been lacerated and torn by the
hook, continues to yield to the temptation of a bait immediately
afterwards. The Greenland Shark when feeding on the carcass of a
whale allows itself to be repeatedly stabbed in the head without
abandoning its prey. A pair of Congers are so dead to external
impression at the time of copulation, and so automatically, as it were,
engaged, that they have been taken by the hand together out of the
water.
CHAPTER VIII.

THE ORGANS OF NUTRITION AND DIGESTION.

Fishes are either exclusively carnivorous or herbivorous, but not


a few feed on vegetable substances as well as animal, or on mud
containing alimentary substance in a living or decomposing state.
Generally they are very voracious, especially the carnivorous kinds,
and the rule of “eat or be eaten” applies to them with unusual force.
They are almost constantly engaged in the pursuit and capture of
their prey, the degree of their power in these respects depending on
the dimensions of the mouth and gullet and the strength of the teeth
and jaws. If the teeth are sharp and hooked, they are capable of
securing the most slender and agile animals; if this kind of teeth is
combined with a wide gullet and distensible stomach, they are able
to overpower and swallow other fish larger than themselves; if the
teeth are broad, strong molars, they are able to crush the hardest
aliments; if they are feeble, they are only serviceable in procuring
some small or inert and unresisting prey. Teeth may be wanting
altogether. Whatever the prey, in the majority of cases it is swallowed
whole; but some of the most voracious fishes, like some Sharks and
Characinidæ, are provided with cutting teeth, which enable them to
tear their prey to pieces if too large to be swallowed whole. Auxiliary
organs for the purpose of overpowering their prey, which afterwards
is seized or torn by the teeth, like the claws of some carnivorous
mammals and birds, are not found in this class; but in a few fishes
the jaws themselves are modified for that purpose. In the Sword-
fishes the bones of the upper jaw form a long dagger-shaped
weapon, with which they not only attack large animals, but also
frequently kill fishes on which they feed. The Saw-fishes are armed
with a similar but still more complicated weapon, the saw, which is
armed on each side with large teeth implanted in deep sockets,
specially adapted for killing and tearing the prey before it is seized
and masticated by the small teeth within the mouth. Fishes show but
little choice in the selection of their food, and some devour their own
offspring indiscriminately with other fishes. Their digestive powers
are strong and rapid, but subject in some degree to the temperature,
which, when sinking below a certain point, lowers the vital powers of
these cold-blooded animals. On the whole, marine fishes are more
voracious than those inhabiting fresh waters; and whilst the latter
may survive total abstinence from food for weeks or months, the
marine species succumb to hunger within a few days. The growth of
fishes depends greatly on the nature and supply of food, and
different individuals of the same species may exhibit a great disparity
in their respective dimensions. They grow less rapidly and to smaller
dimensions in small ponds or shallow streams than in large lakes
and deep rivers. The young of coast fishes, when driven out to sea,
where they find a much smaller supply of food, remain in an
undeveloped condition, assuming an hydropic appearance. The
growth itself seems to continue in most fishes for a great length of
time, and we can scarcely set bounds to—certainly we know not with
precision—the utmost range of the specific size of fishes. Even
among species in no way remarkable for their dimensions we
sometimes meet with old individuals, favourably situated, which
more or less exceed the ordinary weight and measurement of their
kind. However, there are certain evidently short-lived species of
fishes which attain a remarkably uniform size within a very short
time; for instance, the Stickleback, many species of Gobius and
Clupea.

The organs of nutrition, manducation, and deglutition, are lodged


in two large cavities—an anterior (the mouth or buccal cavity), and a
posterior (the abdominal cavity). In the former the alimentary organs
are associated with those fulfilling the respiratory functions, the
transmission of food to the stomach and of water to the gills being
performed by similar acts of deglutition. The abdominal cavity
commences immediately behind the head, so, however, that an
extremely short thoracic cavity for the heart is partitioned off in front.
Beside the alimentary organs it contains also those of the urogenital
system and the air-bladder. The abdominal cavity is generally
situated in the trunk only, but in numerous fishes it extends into the
tail, being continued for some distance along each side of the hæmal
apophyses.
In numerous fishes the abdominal cavity opens outwards by one
or two openings. A single porus abdominalis in front of the vent is
found in Lepidosiren and some Sturgeons; a paired one, one on
each side of the vent, in Ceratodus, some species of Sturgeon,
Lepidosteus, Polypterus, Amia, and all Chondropterygians. As in
these fishes semen and ova are discharged by proper ducts, the
abdominal openings may serve for the expulsion of semen, and
those ova only which, having lost their way to the abdominal
aperture of the oviduct, would be retained in the abdominal cavity. In
those Teleosteans which lack an oviduct a single porus genitalis
opens behind the vent.
The mouth of fishes shows extreme variation with regard to form,
extent, and position. Generally opening in front, it may be turned
upwards, or may lie at the lower side of the snout, as in most
Chondropterygians, Sturgeons, and some Teleosteans. Vogt regards
this position as a persistent fœtal condition. In most fishes the jaws
are covered by the skin, which, before passing over the jaws, is often
folded, forming more or less fleshy lips. In the Sharks the skin retains
its external character even within the teeth, but in other fishes it
changes into a mucous membrane. A tongue may exist as a more or
less free and short projection, formed by the glosso*-hyal and a soft
covering, or may be entirely absent. Salivary glands and a velum
palati are absent in fishes.
With regard to the dentition, the class of Fishes offers an amount
of variation such as is not found in any of the other classes of
Vertebrates. As the teeth form one of the most important elements in
the classification of fishes, their special arrangement and form will be
referred to in the account of the various families and genera. Whilst
not a few fishes are entirely edentulous, in others most of the bones
of the buccal cavity, or some of them, may be toothed, as the bones
of the jaws, the palatines, pterygoids, vomers, basisphenoid,
glossohyal, branchial arches, upper and lower pharyngeals. In others
teeth may be found fixed in some portion of the buccal membrane
without being supported by underlying bone or cartilage; or the teeth
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