Download the Full Version of textbook for Fast Typing at textbookfull.com PostgreSQL Server Programming - Second Edition Dar https://textbookfull.com/product/postgresql-server- programming-second-edition-dar/ OR CLICK BUTTON DOWNLOAD NOW Download More textbook Instantly Today - Get Yours Now at textbookfull.com
Recommended digital products (PDF, EPUB, MOBI) that you can download immediately if you are interested. Learn PostgreSQL - Second Edition -.- https://textbookfull.com/product/learn-postgresql-second-edition/ textboxfull.com PostgreSQL 9 Administration Cookbook - Second Edition Simon Riggs https://textbookfull.com/product/postgresql-9-administration-cookbook- second-edition-simon-riggs/ textboxfull.com DaR Darverius House of DaR 1 1st Edition Jennifer Julie Miller https://textbookfull.com/product/dar-darverius-house-of-dar-1-1st- edition-jennifer-julie-miller/ textboxfull.com PostgreSQL High Availability Cookbook Master over 100 recipes to design and implement a highly available server with the advanced features of PostgreSQL 2nd Edition Shaun M. Thomas https://textbookfull.com/product/postgresql-high-availability- cookbook-master-over-100-recipes-to-design-and-implement-a-highly- available-server-with-the-advanced-features-of-postgresql-2nd-edition- shaun-m-thomas/ textboxfull.com
Windows Server 2016 cookbook Second Edition Krause https://textbookfull.com/product/windows-server-2016-cookbook-second- edition-krause/ textboxfull.com Hands-on Microsoft Windows Server 2016 Second Edition. Edition Palmer https://textbookfull.com/product/hands-on-microsoft-windows- server-2016-second-edition-edition-palmer/ textboxfull.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/ textboxfull.com Learn Python Programming Second Edition Fabrizio Romano https://textbookfull.com/product/learn-python-programming-second- edition-fabrizio-romano/ textboxfull.com Foundations of Programming Languages Second Edition Lee https://textbookfull.com/product/foundations-of-programming-languages- second-edition-lee/ textboxfull.com
Table of Contents PostgreSQL Server Programming Second Edition Credits About the Authors About the Reviewers www.PacktPub.com Support files, eBooks, discount offers, and more Why subscribe? Free access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions 1. What Is a PostgreSQL Server? Why program in the server? Using PL/pgSQL for integrity checks About this book's code examples Switching to the expanded display Moving beyond simple functions Data comparisons using operators Managing related data with triggers Auditing changes Data cleaning Custom sort orders Programming best practices KISS – keep it simple stupid
DRY – don't repeat yourself YAGNI – you ain't gonna need it SOA – service-oriented architecture Type extensibility Caching Wrapping up – why program in the server? Performance Ease of maintenance Improved productivity Simple ways to tighten security Summary 2. Server Programming Environments Cost of acquisition Availability of developers Licensing Predictability Community Procedural languages Third-party tools Platform compatibility Application design Databases are considered harmful Encapsulation What does PostgreSQL offer? Data locality More basics Transactions General error reporting and error handling User-defined functions Other parameters More control Summary 3. Your First PL/pgSQL Function Why PL/pgSQL? The structure of a PL/pgSQL function Accessing function arguments
Conditional expressions Loops with counters Statement termination Looping through query results PERFORM versus SELECT Looping Through Arrays Returning a record Acting on the function's results Summary 4. Returning Structured Data Sets and arrays Returning sets Returning a set of integers Using a set returning function Functions based on views OUT parameters and records OUT parameters Returning records Using RETURNS TABLE Returning with no predefined structure Returning SETOF ANY Variadic argument lists A summary of the RETURN SETOF variants Returning cursors Iterating over cursors returned from another function Wrapping up of functions returning cursors Other ways to work with structured data Complex data types for the modern world – XML and JSON XML data type and returning data as XML from functions Returning data in the JSON format Summary 5. PL/pgSQL Trigger Functions Creating the trigger function Creating the trigger Working on a simple "Hey, I'm called" trigger The audit trigger
Disallowing DELETE Disallowing TRUNCATE Modifying the NEW record The timestamping trigger The immutable fields trigger Controlling when a trigger is called Conditional triggers Triggers on specific field changes Visibility Most importantly – use triggers cautiously! Variables passed to the PL/pgSQL TRIGGER function Summary 6. PostgreSQL Event Triggers Use cases for creating event triggers Creating event triggers Creating an audit trail Preventing schema changes A roadmap of event triggers Summary 7. Debugging PL/pgSQL Manual debugging with RAISE NOTICE Throwing exceptions Logging to a file The advantages of RAISE NOTICE The disadvantages of RAISE NOTICE Visual debugging Installing the debugger Installing the debugger from the source Installing pgAdmin3 Using the debugger The advantages of the debugger The disadvantages of the debugger Summary 8. Using Unrestricted Languages Are untrusted languages inferior to trusted ones? Can you use untrusted languages for important functions?
Will untrusted languages corrupt the database? Why untrusted? Why PL/Python? Quick introduction to PL/Python A minimal PL/Python function Data type conversions Writing simple functions in PL/Python A simple function Functions returning a record Table functions Running queries in the database Running simple queries Using prepared queries Caching prepared queries Writing trigger functions in PL/Python Exploring the inputs of a trigger A log trigger Constructing queries Handling exceptions Atomicity in Python Debugging PL/Python Using plpy.notice() to track the function's progress Using assert Redirecting sys.stdout and sys.stderr Thinking out of the "SQL database server" box Generating thumbnails when saving images Sending an e-mail Listing directory contents Summary 9. Writing Advanced Functions in C The simplest C function – return (a + b) add_func.c Version 0 call conventions Makefile CREATE FUNCTION add(int, int) add_func.sql.in
Summary for writing a C function Adding functionality to add(int, int) Smart handling of NULL arguments Working with any number of arguments Basic guidelines for writing C code Memory allocation Use palloc() and pfree() Zero-fill the structures Include files Public symbol names Error reporting from C functions "Error" states that are not errors When are messages sent to the client? Running queries and calling PostgreSQL functions A sample C function using SPI Visibility of data changes More info on SPI_* functions Handling records as arguments or returned values Returning a single tuple of a complex type Extracting fields from an argument tuple Constructing a return tuple Interlude – what is Datum? Returning a set of records Fast capturing of database changes Doing something at commit/rollback Synchronizing between backends Writing functions in C++ Additional resources for C Summary 10. Scaling Your Database with PL/Proxy Creating a simple single-server chat Dealing with success – splitting tables over multiple databases What expansion plans work and when? Moving to a bigger server Master-slave replication – moving reads to slave Multimaster replication
Data partitioning across multiple servers Splitting the data PL/Proxy – the partitioning language Installing PL/Proxy The PL/Proxy language syntax CONNECT, CLUSTER, and RUN ON SELECT and TARGET SPLIT – distributing array elements over several partitions The distribution of data Configuring the PL/Proxy cluster using functions Configuring the PL/Proxy cluster using SQL/MED Moving data from the single to the partitioned database Connection Pooling Summary 11. PL/Perl – Perl Procedural Language When to use PL/Perl Installing PL/Perl A simple PL/Perl function Passing and returning non-scalar types Writing PL/Perl triggers Untrusted Perl Summary 12. PL/Tcl – Tcl Procedural Language Installing PL/Tcl A simple PL/Tcl function Null checking with Strict functions The parameter format Passing and returning arrays Passing composite-type arguments Accessing databases Writing PL/Tcl triggers Untrusted Tcl Summary 13. Publishing Your Code as PostgreSQL Extensions When to create an extension Unpackaged extensions
Extension versions The .control file Building an extension Installing an extension Viewing extensions Publishing your extension Introduction to PostgreSQL Extension Network Signing up to publish your extension Creating an extension project the easy way Providing the metadata about the extension Writing your extension code Creating the package Submitting the package to PGXN Installing an extension from PGXN Summary 14. PostgreSQL as an Extensible RDBMS What can't be extended? Creating a new operator Overloading an operator Optimizing operators COMMUTATOR NEGATOR Creating index access methods Creating user-defined aggregates Using foreign data wrappers Summary Index
PostgreSQL Server Programming Second Edition
PostgreSQL Server Programming Second Edition Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: June 2013 Second edition: February 2015 Production reference: 1210215 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78398-058-1 www.packtpub.com
Credits Authors Usama Dar Hannu Krosing Jim Mlodgenski Kirk Roybal Reviewers Stephen Frost Rick van Hattem Vibhor Kumar Jeff Lawson Mariano Reingart Julien Tachoires Commissioning Editor Usha Iyer Acquisition Editors Antony Lowe Meeta Rajani Sam Wood
Content Development Editor Adrian Raposo Technical Editors Mrunmayee Patil Chinmay Puranik Copy Editors Dipti Kapadia Aarti Saldanha Project Coordinator Kinjal Bari Proofreaders Maria Gould Linda Morris Indexer Monica Ajmera Mehta Production Coordinator Nitesh Thakur Cover Work Nitesh Thakur
About the Authors Usama Dar is a seasoned software developer and architect. During his 14 years' career, he has worked extensively with PostgreSQL and other database technologies. He worked on PostgreSQL internals extensively while he was working for EnterpriseDB. Currently, he lives in Munich where he works for Huawei's European Research Center. He designs the next generation of high-performance database systems based on open source technologies, such as PostgreSQL, which are used under high workloads and strict performance requirements. Hannu Krosing was a PostgreSQL user before it was rewritten to use SQL as its main query language in 1995. Therefore, he has both the historic perspective of its development, as well as almost 20 years of experience in using it to solve various real-life problems. He was the first database administrator and database architect at Skype, where he invented the sharding language PL/Proxy that allows you to scale the user database in order to work with billions of users. After he left Skype at the end of 2006—about a year after it was bought by eBay—he has been working as a PostgreSQL consultant with 2ndQuadrant, the premier PostgreSQL consultancy with a global reach and local presence in most parts of the world. He has coauthored PostgreSQL 9 Administration Cookbook, Packt Publishing, together with one of the main PostgreSQL developers, Simon Riggs. I want to sincerely thank my wife, Evelyn, for her support while writing this book.
Jim Mlodgenski is the CTO of OpenSCG, a professional services company focused on leveraging open source technologies for strategic advantage. He was formerly the CEO of StormDB, a database cloud company focused on horizontal scalability. Prior to StormDB, he has held highly technical roles at Cirrus Technology, Inc., EnterpriseDB, and Fusion Technologies. Jim is also a fervent advocate of PostgreSQL. He is on the board of the United States PostgreSQL Association as well as a part of the organizing teams of the New York PostgreSQL User Group and Philadelphia PostgreSQL User Group. Kirk Roybal has been an active member of the PostgreSQL community since 1998. He has helped organize user groups in Houston, Dallas, and Bloomington, IL. He has mentored many junior database administrators and provided cross-training to senior database engineers. He has provided solutions using PostgreSQL for reporting, business intelligence, data warehousing, applications, and development support. He saw the scope of PostgreSQL when his first small-scale business customer asked for a web application. At that time, competitive database products were either extremely immature or cost prohibitive. Kirk has stood by his choice of PostgreSQL for many years now. His expertise is founded on keeping up with features and capabilities as they become available. Writing a book has been a unique experience for me. Many people fantasize about it, few start one, and even fewer get to publication. I am proud to be part of a team that actually made it to the book shelf (which itself is a diminishing breed). Thanks to Sarah Cullington from Packt Publishing for giving me a chance to participate in the project. I believe that the PostgreSQL
community will be better served by this information, and I hope that they receive this as a reward for the time that they have invested in me over the years. A book only has the value that the readers give it. Thank you to the PostgreSQL community for all the technical, personal, and professional development help you have provided. The PostgreSQL community is a great bunch of people, and I have enjoyed the company of many of them. I hope to contribute more to this project in the future, and I hope you find my contributions as valuable as I find yours. Thank you to my family for giving me a reason to succeed and for listening to the gobbledygook and nodding appreciatively. Have you ever had your family ask you what you were doing and answered them with a function? Try it. No, then again, don't try it. They may just have you involuntarily checked in somewhere.
About the Reviewers Stephen Frost is a major contributor and committer to PostgreSQL, who has been involved with PostgreSQL since 2002, and has developed features such as the role system and column-level privileges. He is the chief technology officer at Crunchy Data Solutions, Inc., the PostgreSQL company for Secure Enterprises. He is involved in the advancement of PostgreSQL's capabilities, particularly in the area of security in order to support the needs of government and financial institutions who have strict security and regulatory requirements. Rick van Hattem is an entrepreneur with a computer science background and a long-time open source developer with vast experience in the C, C++, Python, and Java languages. Additionally, he has worked with most large database servers such as Oracle, MS SQL, and MySQL, but he has been focusing on PostgreSQL since Version 7.4. He is one of the founders of the Fashiolista.com social network, and until recently, he was the CTO. Here, he used PostgreSQL to scale the feeds for millions of users to show that PostgreSQL can hold up to NoSQL solutions, given some tuning and additional tools. After Fashiolista, he worked as a freelance consultant for several companies, including 2ndQuadrant. He is currently the founder of PGMon.com, a monitoring service that analyzes your databases, indexes, and queries to keep them running at peak performance. In addition to analyzing your database settings, the system actively monitors your queries and gives you recommendations to enhance performance. He is also the creator and maintainer of a large number of open source projects, such as pg_query_analyser, pg_cascade_timestamp,
QtQuery, Python-Statsd, and Django-Statsd. Vibhor Kumar is a principal system architect at EnterpriseDB who specializes in assisting Fortune 100 companies to deploy, manage, and optimize Postgres databases. He joined EnterpriseDB in 2008 to work with Postgres after several years of working with Oracle systems. He has worked in team leadership roles at IBM Global Services and BMC Software as well as an Oracle database administrator at CMC Ltd. for several years. He has developed expertise in Oracle, DB2, and MongoDB and holds certifications in them. He has experience working with MS SQL Server, MySQL, and data warehousing. He holds a bachelor's degree in computer science from the University of Lucknow and a master's degree in computer science from the Army Institute of Management, Kolkata. He is a certified PostgreSQL trainer and holds a professional certification in Postgres Plus Advanced Server from EnterpriseDB. Jeff Lawson has been a fan and user of PostgreSQL since the time he discovered it in 2001. Over the years, he has also developed and deployed applications for IBM DB2, Oracle, MySQL, Microsoft SQL Server, Sybase, and others, but he always prefers PostgreSQL for its balance of features and openness. Much of his experience involves developing for Internet-facing websites/projects that require highly scalable databases with high availability or with provisions for disaster recovery. He currently works as the director of software development for FlightAware, which is an airplane-tracking website that uses PostgreSQL and other open source software to store and analyze the positions of the thousands of flights that are operated worldwide every day. He has extensive experience in software architecture, data security, and network protocol design from the software engineering positions he has held at Univa / United Devices, Microsoft, NASA's Jet Propulsion Laboratory, and WolfeTech. He is a founder of distributed.net, which pioneered distributed computing in the 1990s, and he continues to serve as the chief of operations and
as a member of the board there. He earned a BSc degree in computer science from Harvey Mudd College. He is fond of cattle, holds an FAA private pilot certificate, and owns an airplane based in Houston, Texas. Mariano Reingart lives in Buenos Aires, Argentina, and is a specialist in the software development of applications and libraries (web services, PDF, GUI, replication, and so on) with more than 10 years of experience. Currently, he is the PostgreSQL regional contact for Argentina and a Python Software Foundation member. He is a major contributor to the web2py Python web framework, and now he's working on the wxWidgets multiplatform GUI toolkit (specifically in the Qt port and Android mobile areas). Also, he has contributed to more than a dozen open source projects, including an interface for Free Electronic Invoice web services (PyAfipWs) and Pythonic replication for PostgreSQL (PyReplica). He has a bachelor's degree in computer systems analysis, and currently, he's a master's candidate for the MSc in free software degree at the Open University of Catalonia. He works on his own funded entrepreneurial venture formed by an open group of independent professionals, dedicated to software development, training, and technical support, focusing on open source tools (GNU/Linux, Python, PostgreSQL, and web2py/wxPython). He has worked for local Python-based companies in large business applications (ERP, SCM, and CRM) and mission critical systems (election counting, electronic voting, and 911 emergency events support). He has contributed to books such as web2py Enterprise Web Framework, Third Edition, and web2py Application Development Cookbook, Packt Publishing, and several Spanish translations of the PostgreSQL official documentation.
His full resume is available at http://reingart.blogspot.com/p/resume.html. Julien Tachoires is a PostgreSQL specialist, who works as consultant for the French PostgreSQL company Dalibo. He is the main developer of pg_activity, a top-end software dedicated to follow the PostgreSQL incoming traffic in real time, which is written in Python. I want to thank my employer Dalibo; my wife, Camille; and my son, Arthur.
www.PacktPub.com Support files, eBooks, discount offers, and more For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <service@packtpub.com> for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content
On demand and accessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface This fascinating guide to server programming will take your skills of PostgreSQL to a whole new level. A step-by-step approach with illuminating examples will educate you about the full range of possibilities. You will understand the extension framework of PostgreSQL and leverage it in ways you haven't even invented yet. You will learn how to write functions and create your own data types, all in your favorite programming language. It is a step-by-step tutorial, with plenty of tips and tricks to kick-start server programming.
What this book covers Chapter 1, What Is a PostgreSQL Server?, introduces you to the PostgreSQL server and will set the tone for the rest of the book. It introduces you to the ways in which a PostgreSQL server is extendible, and shows you that it can be treated as a complete software development framework instead of just a database server. Chapter 2, Server Programming Environments, elaborates that PostgreSQL is built to handle user needs, but more importantly, it is built not to change underneath users in the future. It will touch upon the environments and will highlight some of the important things to be kept in mind when programming on the server in PostgreSQL. Chapter 3, Your First PL/pgSQL Function, builds the foundations by demonstrating how to write simple PL/pgSQL functions. Chapter 4, Returning Structured Data, builds on the knowledge of writing PL/pgSQL functions and demonstrates how to write functions that return a set of values such as rows, arrays, and cursors. Chapter 5, PL/pgSQL Trigger Functions, discusses how to write PL/pgSQL functions that are used to write trigger logic. It also discusses the various types of triggers available in PostgreSQL and the options that a database developer has when writing such functions. Chapter 6, PostgreSQL Event Triggers, discusses PostgreSQL's event trigger functionality. Event triggers are fired when running a DDL operation on a table. This chapter discusses the various possibilities and options of creating event triggers and their limitations in PostgreSQL. Chapter 7, Debugging PL/pgSQL, elaborates on how to debug PL/pgSQL's stored procedures and functions in PostgreSQL. This
chapter explains how to install the debugger plugin and use the pgAdmin debugger console. Chapter 8, Using Unrestricted Languages, explains the differences between restricted and unrestricted PostgreSQL languages. This chapter uses PL/Python as an example and demonstrates the examples of both restricted and unrestricted functions in PL/Python. Chapter 9, Writing Advanced Functions in C, explains how to extend PostgreSQL by writing user-defined functions (UDFs) in C. Chapter 10, Scaling Your Database with PL/Proxy, explains the use of a special programming language in PostgreSQL called PL/Proxy and how to use it in order to partition and shard your database. Chapter 11, PL/Perl – Perl Procedural Language, discusses a popular PL language in PostgreSQL called PL/Perl. This chapter uses some simple examples to demonstrate how you can use Perl to write database functions. Chapter 12, PL/Tcl – Tcl Procedural Language, discusses Tcl as a language of choice when writing database functions. It discusses the pros and cons of using Tcl in the database. Chapter 13, Publishing Your Code as PostgreSQL Extensions, discusses how to package and distribute the PostgreSQL extensions. Well-packaged extensions can be easily distributed and installed by other users. This chapter also introduces you to the PostgreSQL Extension Network (PGXN) and shows you how to use it to get the extensions published by other developers. Chapter 14, PostgreSQL as an Extensible RDBMS, discusses more extensibility options in PostgreSQL, such as creating new data types, operators, and index methods.
What you need for this book In order to follow this book, you need the following software: PostgreSQL Database Server 9.4 Linux/Unix Operating System Python 2, Perl, and Tcl
Who this book is for This book is for moderate to advanced level PostgreSQL database professionals. To get a better understanding of this book, you should have a general experience in writing SQL, a basic idea of query tuning, and some coding experience in a language of your choice.
Conventions In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "If any of the checks fail, you should do ROLLBACK instead of COMMIT." A block of code is set as follows: CREATE TABLE accounts(owner text, balance numeric, amount numeric); INSERT INTO accounts VALUES ('Bob',100); INSERT INTO accounts VALUES ('Mary',200); When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: CREATE OR REPLACE FUNCTION fibonacci_seq(num integer) RETURNS SETOF integer AS $$ DECLARE a int := 0; b int := 1; BEGIN IF (num <= 0) THEN RETURN; END IF;
Another Random Scribd Document with Unrelated Content
After making several inquiries, we eventually located a small house on the edge of town. In response to our insistent hammering, the door of the house was finally opened by a pallid young man probably in his late twenties. If he was the object of the captain’s search he had certainly undergone a remarkable metamorphosis, for he bore little resemblance to the dapper officer of whom Captain Vassalle carried a photograph for identification. The captain seemed satisfied that he was the man. So leaving them in conversation, the three of us followed up the business of the reported works of art. The other two occupants of the house—an old man and a young woman who may have been the wife of the man who had opened the door— responded to our questions with alacrity and took us to the cellar. There we were shown a cache of pictures, all of them unframed and none of them of any value. They appeared to be what the old man claimed—their own property, brought to Bad Brückenau when they had left Frankfurt to escape the bombings. In any case, we made a listing of the canvases, identifying them as best we could and making notations of the sizes, and also admonishing the couple not to remove them from the premises. After that the old man took us across the back yard to a large modern barn which was heavily padlocked. Once inside he unshuttered a row of windows along one side of the main, ground- floor room. It was jammed to the ceiling with every conceivable item of household furnishings: chairs, tables, beds, bedding, kitchen utensils and porcelain. But no pictures. We poked around enough to satisfy ourselves that first appearances were not deceiving. They weren’t, so, having made certain that the old fellow, who claimed to be merely the custodian of these things, understood the regulations forbidding their removal, we picked up Captain Vassalle. He had completed his interrogation of the alleged SS officer and placed him under house arrest. Our next objective was an old Schloss which, according to our map, was still a good hour’s drive to the northeast. As it was nearly noon and we were all hungry, we decided to investigate the possibilities of food in the neighborhood. On our way back through Bad Brückenau we stopped at the office of a small detachment of
troops and asked where we could get some lunch. The hospitable second lieutenant on duty in the little stucco building, which had once been part of the Kurhaus establishment, gave us directions to the sprawling country hotel, high up above the town, where his outfit was quartered. He said that he would telephone ahead to warn the mess sergeant of our arrival. For a little way we followed along the Sinn, which flows through the grassy valley in which Bad Brückenau nestles. Then we began to mount sharply and, for the next fifteen minutes, executed a series of hairpin turns and ended abruptly beside a rambling structure which commanded a wonderful view of the valley and the wooded hills on the other side. Our hosts were a group of friendly young fellows who seemed delighted to have the monotony of their rural routine interrupted by our visit. They asked Charlie and me the usual question—what was the Navy doing in the middle of Germany—and got our stock reply: we are planning to dig a canal from the North Sea to the Mediterranean. We had a heavy downpour during lunch, and we waited for the rain to let up before starting out again. Then we took the winding road down into town, crossed the river and drove up into the hills on the other side of the valley. An hour’s drive brought us to upland meadow country and a grove of handsome lindens. At the end of a long double row of these fine trees stood Schloss Rossbach. “Castle” was a rather pompous name for the big seventeenth century country house with whitewashed walls and heavily barred ground- floor windows. We were received by the owners, a Baron Thüngen and his wife, and explained that we had come to examine the condition of the works of art, which, according to our information, had been placed there for safekeeping. They ushered us up to a comfortable sitting room on the second floor where we settled down to wait while the baroness went off to get the keys. In the meantime we had a few words with her husband. His manner was that of the haughty landed proprietor, and he looked the part. He was a big, burly man in his sixties. He was dressed in rough tweeds and wore a matching hat, adorned with a bushy “shaving brush,” which he hadn’t bothered to
remove indoors. That may have been unintentional, but I idly wondered if it weren’t deliberate discourtesy and rather wished that I had kept my own cap on. I wished also that I could have matched his insolent expression, but thought it unlikely because I was frankly enjoying the obvious distaste which our visit was causing the old codger. However, his attitude was almost genial compared with that of his waspish wife, who reappeared about that time, armed with a huge hoop from which a great lot of keys jangled. The baroness, who was much younger than her husband, had very black hair and discontented dark eyes. She spoke excellent English, without a trace of accent. I felt reasonably sure that she was not German but couldn’t guess her nationality. It turned out that she was from the Argentine. She was a sullen piece and made no effort to conceal her irritation at our intrusion. She explained that neither she nor her husband had anything to do with the things stored there; that, in fact, it was a great inconvenience having to put up with them. She had asked the young woman who knew all about them to join us. The young woman in question arrived and was completely charming. She took no apparent notice of the baroness’ indifference, which was that of a mistress toward a servant whom she scarcely knew. Her fresh, open manner cleared the atmosphere instantly. She introduced herself as Frau Holzinger, wife of the director of Frankfurt’s most famous museum, the Staedelsches Kunstinstitut. Because of conditions in Frankfurt, and more particularly because their house had been requisitioned by the American military authorities, she had come to Schloss Rossbach with her two young children. Country life, she continued, was better for the youngsters and, besides, her husband had thought that she might help with the things stored at the castle. I had met Dr. Holzinger when I went one day to have a look at what remained of the museum, so his wife and I hit it off at once. I was interested to learn that she was Swiss and a licensed physician. She smilingly suggested that we make a tour of the castle and she would show us what was there. The first room to be inspected was a library adjoining the sitting room in which we had been waiting. Here we found a quantity of
excellent French Impressionist paintings, all from the permanent collection of the Staedel, and a considerable number of fine Old Master drawings. Most of these were likewise the property of the museum, but a few—I remember one superb Rembrandt sketch— appeared to have come from Switzerland. Those would, of course, have to be looked into later, to determine their exact origin and how they came to be on loan at the museum. But for the moment we were concerned primarily with storage conditions and the problem of security. In another room we found an enormous collection of books, the library of one of the Frankfurt museums. In a third we encountered an array of medieval sculpture—saints of all sizes and description, some of carved wood, others of stone, plain or polychromed. These too were of museum origin. The last storage room was below ground, a vast, cavernous chamber beneath the house. Here was row upon row of pictures, stacked in two tiers down the center of the room and also along two sides. From what we could make of them in the poor light, they were not of high quality. During the summer months they would be all right in this underground room, but we thought that the place would be very damp in the winter. Frau Holzinger assured us that this was so and that the pictures should be removed before the bad weather set in. The baroness chipped in at this point and affably agreed with that idea, undoubtedly happy to further any scheme which involved getting rid of these unwelcome objects. She also warned us that the castle was far from safe as it was, what with roving bands of Poles all over the countryside. As we indicated that we were about to take our leave, she elaborated upon this theme, declaring that their very lives were in danger, that every night she and her husband could hear prowlers in the park. Since they—as Germans—were not allowed to have firearms, they would be at the mercy of these foreign ruffians if they should succeed in breaking into the castle. By this time we were all pretty fed up with the whining baroness. As we turned to go, Charlie Kuhn, eyeing her coldly, asked, “Who brought those Poles here in the first place, madam? We didn’t.”
To our delight, the weather had cleared and the sun was shining. Ahead of us on the roadway, the foliage of the lindens made a gaily moving pattern. Our work for the day was done and we still had half the afternoon. I got out the map and, after making some quick calculations, proposed that we could take in Würzburg and still get back to Frankfurt at a reasonable hour. We figured out that, with the extra jerry can of gas we had with us, we could just about make it. We would be able to fill up at Würzburg for the return trip. So, instead of continuing on the road back to Bad Brückenau, we turned south in the direction of Karlstadt. It was pleasant to be traveling a good secondary road instead of the broad, characterless Autobahn, on which there were no unexpected turns, no picturesque villages. There was little traffic, so we made very good time. In half an hour we had threaded our way through Karlstadt-on-the-Main. In this part of Franconia the Main is a capricious river, winding casually in and out of the gently undulating hills. A little later we passed the village of Veitschöchheim where the Prince-Bishops of Würzburg had an elaborate country house during the eighteenth century. The house still stands, and its gardens, with a tiny lake and grottoes in the Franco-Italian manner, remain one of the finest examples of garden planning of that day. As we drove by we were glad that this inviting spot had not attracted the attention of our bombers. Alas, such was not the case with Würzburg, as we realized the minute we reached its outskirts! The once-gracious city, surely one of the most beautiful in all Germany, was an appalling sight. Its broad avenues were now lined with nothing but the gaping, ruined remnants of the stately eighteenth century buildings which had lent the city an air of unparalleled distinction and consistency of design. High on its hilltop above the Main, the mellow walls of the medieval fortress of Marienberg caught the rays of the late afternoon sun. From the distance, the silhouette of that vast structure appeared unchanged, but the proud city of the Prince-Bishops which it overlooked was laid low. We drove slowly along streets not yet cleared of rubble, until we came to the Residenz, the great palace of the Prince-Bishops, those
lavish patrons of the arts to whom the city owed so much of its former grandeur. This magnificent building, erected in the first half of the eighteenth century by the celebrated baroque architect, Johann Balthasar Neumann, for two Prince-Bishops of the Schönborn family, was now a ghost palace, its staring glassless windows and blackened walls pathetic vestiges of its pristine splendor. We walked up to the main entrance wondering if it could really be true that the crowning glory of the Residenz—the glorious ceiling by Tiepolo, representing Olympus and the Four Continents—was, as we had been told, still intact. With misgivings we turned left across the entrance hall to the Treppenhaus and mounted the grand staircase. We looked up and there it was—as dazzling and majestically beautiful as ever—that incomparable fresco, the masterpiece of the last great Italian painter. Someone with a far greater gift for words than I may be able to convey the exaltation one experiences on seeing that ceiling, not just for the first time but at any time. I can’t. It leaves artist and layman alike absolutely speechless. I think that, if I had to choose one great work of art, it would be this ceiling in the Residenz. You can have even the Sistine ceiling. I’ll take the Tiepolo. For the next half hour we examined every corner of it. Aside from a few minor discolorations, the result of water having seeped through the lower side of the vault just above the cornice, the fresco was undamaged. Considering the destruction throughout the rest of the building, I could not understand how this portion of the palace could be in such a remarkable state of preservation. The explanation was an interesting example of how good can sometimes come out of evil. Some forty years ago, as I remember the story, there was a fire in the Residenz. The wooden roof over a large portion, if not all, of the building was burned away. When it came to replacing the roof, the city fathers decided it would be a prudent idea to cover the part above the Tiepolo with steel and concrete. This was done, and consequently, when the terrible conflagration of March 1945 swept Würzburg—following the single raid of twenty minutes which destroyed the city—the fresco was spared. As we wandered through other rooms of the Residenz—the Weisser Saal with its elaborate stucco ornamentation and the sumptuous Kaiser Saal facing the
garden, once classic examples of the Rococo—I wished that those city fathers had gone a little farther with their steel and concrete. We stopped briefly to examine the chapel in the south wing. Here, miraculously enough, there had been relatively little damage, but the caretaker expressed concern over the condition of the roof and said that if it weren’t repaired before the heavy rains the ceiling would be lost. Knowing how hard it was to obtain building materials for even the most historic monuments when people didn’t have a roof over their heads, we couldn’t reassure him with much conviction. The spectacle of ruined Würzburg had a depressing effect upon us, so we weren’t very talkative on our way back to Frankfurt. We passed through only one town of any size, Aschaffenburg, which, like Würzburg, had suffered severe damage. Although I had not been long in Germany and had seen but few of her cities, I was beginning to realize that the reports of the Allied air attacks had not been exaggerated. I was ready to believe that there were only small towns and villages left in this ravaged country. One morning Charlie Kuhn rang up to say that I should meet him at the Reichsbank early that afternoon. This was something I had been looking forward to for some time, the chance to look at the wonderful things from the Merkers mine which were temporarily stored there. With Charlie came two members of the MFA&A organization whom I had not seen since Versailles and then only briefly. They had been stationed at Barbizon, as part of the Allied Group Control Council for Germany (usually referred to simply as “Group CC”) the top level policy-making body as opposed to SHAEF, which dealt with the operational end of things. These two gentlemen were John Nicholas Brown, who had come over to Germany with the assimilated rank of colonel as General Eisenhower’s adviser on cultural affairs, and Major Mason Hammond, in civilian life professor of the Classics at Harvard. It had been decided, now that we were about to acquire a permanent depot in which to store the treasures, to make one Monuments officer responsible for the entire collection. By this transfer of custody, the Property Control Officer in whose charge the
things were at present, could be relieved of that responsibility. Major Hammond had with him a paper designating me as custodian. Knowing in a general way what was stored in the bank, I felt that I was on the point of being made a sort of director, pro tem, of the Kaiser Friedrich Museum. The genial Property Control Officer, Captain William Dunn, was all smiles at the prospect of turning his burden over to someone else. But before this transfer could be made, a complete check of every item was necessary. Major Hammond knew just how he wanted this done. I was to have two assistants, who could come over the next morning from his office in Hoechst, twenty minutes from Frankfurt. The three of us, in company with Captain Dunn, would make the inventory. We wandered through the series of rooms in which the things were stored. In the first room were something like four hundred pictures lined up against the wall in a series of rows. In two adjoining rooms were great wooden cases piled one above another. In a fourth were leather-bound boxes containing the priceless etchings, engravings and woodcuts from the Berlin Print Room. Still another room was filled with cases containing the renowned Egyptian collections. It was rumored that one of them held the world-famous head of Queen Nefertete, probably the best known and certainly the most beloved single piece of all Egyptian sculpture. It had occupied a place of special honor in the Berlin Museum, in a gallery all to itself. Still other rooms were jammed with cases of paintings and sculpture of the various European schools. In a series of smaller alcoves were heaped huge piles of Oriental rugs and rare fabrics. And last, one enormous room with bookshelves was filled from floor to ceiling with some thirty thousand volumes from the Berlin Patent Office. Quite separate and apart from all these things was a unique collection of ecclesiastical vessels of gold and silver, the greater part of them looted from Poland. These extremely precious objects were kept in a special vault on the floor above.
Captain Dunn brought out a thick stack of papers. It was the complete inventory. Major Hammond said that the two officers who would help with the checking were a Captain Edwin Rae and a WAC lieutenant named Standen. Aside from having heard that Rae had been a student of Charlie Kuhn’s at Harvard, I knew nothing about him. But the name Standen rang a bell: was she, by any chance, Edith Standen who had been curator of the Widener Collection? Major Hammond smilingly replied, “The same.” I had known her years ago in Cambridge where we had taken Professor Sachs’ course in Museum Administration at the same time. I remembered her as a tall, dark, distinguished-looking English girl. To be exact, she was half English: her father had been a British Army officer, her mother a Bostonian. Recalling her very reserved manner and her scholarly tastes, I found it difficult to imagine her in uniform. Early the following morning, I met my cohorts at the entrance to the Reichsbank. I was pleasantly surprised to find that Captain Rae was an old acquaintance if not an old friend. He also had been around the Fogg Museum in my time. Edith looked very smart in her uniform. She had a brisk, almost jovial manner which was not to be reconciled with her aloof and dignified bearing in the marble halls of the Widener house at Elkins Park. We hunted up Captain Dunn and set to work. Our first task was to count and check off the paintings stacked in the main room. We got through them with reasonable speed, refraining with some difficulty from pausing to admire certain pictures we particularly fancied. Then we tackled the Oriental rugs, and that proved to be a thoroughly thankless and arduous task. We had a crew of eight PWs—prisoners of war—to help us spread the musty carpets out on the floor. Owing to the fact that the smaller carpets—in some cases they were hardly more than fragments—had been rolled up inside larger ones, we ended with nearly a hundred more items than the inventory called for. That troubled Captain Dunn a bit, but I told him that it didn’t matter so long as we were over. We’d have to start worrying only if we came out short. By five o’clock we were tired and dirty and barely a third of the way through with the job.
The next day we started in on the patent records. There had been a fire in the mine where the records were originally stored. Many of them were slightly charred, and all of them had been impregnated with smoke. When we had finished counting the whole thirty thousand, we smelled just the way they did. As a matter of fact we hadn’t wanted to assume responsibility for these records in the first place. Certainly they had nothing to do with art. But Major Hammond had felt that they properly fell to us as archives. And of course they were archives of a sort. On the morning of the third day, as I was about to leave my office for the Reichsbank, I had a phone call from Charlie Kuhn. He asked me how the work was coming along and then, in a guarded voice, said that something unexpected had turned up and that he might have to send me away for a few days. He told me he couldn’t talk about it on the telephone, and anyway, it wasn’t definite. He’d probably know by afternoon. I was to call him later. This was hardly the kind of conversation to prepare one for a humdrum day of taking inventory, even if one were counting real treasure. And for a person with my curiosity, the morning’s work was torture. When I called Charlie after lunch he was out but had left word that I was to come to his office at two o’clock. When I got there he was sitting at his desk. He looked up from the dispatch he was reading and said with a rueful smile, “Tom, I am going to send you out on a job I’d give my eyeteeth to have for myself.” Then he explained that certain developments had suddenly made it necessary to step up the work of evacuating art repositories down in Bavaria and in even more distant areas. For the first time in my life I knew what was meant by the expression “my heart jumped a beat”—for that was exactly what happened to mine! No wonder Charlie was envious. This sounded like the real thing. Charlie told me that I was to fly down to Munich the next morning and that I would probably be gone about ten days. To save time he had already had my orders cut. All I had to do was to pick them up at the AG office. I was to report to Third Army Headquarters and get in touch with George Stout as soon as possible. Charlie didn’t know just where I’d find George. He was out in the wilds somewhere. As a
matter of fact he wasn’t too sure about the exact location of Third Army Headquarters. A new headquarters was being established and the only information he had was that it would be somewhere in or near Munich. The name, he said, would be “Lucky Rear” and I would simply have to make inquiries and be guided by signs posted along the streets. I asked Charlie what I should do about the completion of the inventory at the Reichsbank, and also about the impending report from the Corps of Engineers on the University of Frankfurt building. He suggested that I leave the former in Captain Rae’s hands and the latter with Lieutenant Buchman. Upon my return I could take up where I had left off. That evening I threw my things together, packing only enough clothes to see me through the next ten days. Not knowing where I would be billeted I took the precaution of including my blankets. Even at that my luggage was compact and light, which was desirable as I was traveling by air.
(3) MUNICH AND THE BEGINNING OF FIELD WORK The next morning I was up before six and had early breakfast. It was a wonderful day for the trip, brilliantly clear. The corporal in our office took me out to the airfield, the one near Hanau where Craig Smyth and I had landed weeks before. It was going to be fun to see Craig again and find out what he had been up to since we had parted that morning in Bad Homburg. The drive to the airfield took about forty-five minutes. There was a wait of half an hour at the field, and it was after ten when we took off in our big C-47. We flew over little villages with red roofs, occasionally a large town—but none that I could identify—and now and then a silvery lake. Just before we reached Munich, someone said, “There’s Dachau.” Directly below us, on one side of a broad sweep of dark pine trees, we saw a group of low buildings and a series of fenced-in enclosures. On that sunny morning the place looked deserted and singularly peaceful. Yet only a few weeks before it had been filled with the miserable victims of Nazi brutality. In another ten minutes we landed on the dusty field of the principal Munich airport. Most of the administration buildings had a slightly battered look but were in working order. It was a welcome relief to take refuge from the blazing sunshine in the cool hallway of the main building. The imposing yellow brick lobby was decorated with painted shields of the different German states or “Länder.” The arms of Bavaria, Saxony, Hesse-Nassau and the rest formed a colorful frieze around the walls. A conveyance of some kind was scheduled to leave for town in a few minutes. Meanwhile there were sandwiches and coffee for the plane passengers. By the time we had finished, a weapons carrier had pulled up before the entrance. Several of us climbed into its
dust-encrusted interior. It took me a little while to get my bearings as we drove toward Munich. I had spotted the familiar pepper-pot domes of the Frauenkirche from the air but had recognized no other landmark of the flat, sprawling city which I had known well before the war. It was not until we turned into the broad Prinz Regenten-Strasse that I knew exactly where I was. As we drove down this handsome avenue, I got a good look at a long, colonnaded building of white stone. The roof was draped with what appeared to be an enormous, dark green fishnet. The billowing scallops of the net flapped about the gleaming cornice of the building. It was the Haus der Deutschen Kunst, the huge exhibition gallery dedicated by Hitler in the middle thirties to the kind of art of which he approved—an art in which there was no place for untrammeled freedom of expression, only the pictorial and plastic representation of all the Nazi regime stood for. The dangling fishnet was part of the elaborate camouflage. I judged from the condition of the building that the net had admirably served its purpose. In a moment we rounded the corner by the Prinz Karl Palais. Despite the disfiguring coat of ugly olive paint which covered its classic façade, it had not escaped the bombs. The little palace, where Mussolini had stayed, had a hollow, battered look and the formal garden behind it was a waste of furrowed ground and straggling weeds. We turned left into the wide Ludwig-Strasse and came to a grinding halt beside a bleak gray building whose walls were pockmarked with artillery fire. I asked our driver if this were Lucky Rear headquarters and was told curtly that it wasn’t, but that it was the end of the line. It was MP headquarters and I’d have to see if they’d give me a car to take me to my destination, which the driver said was “’way the hell” on the other side of town. Before going inside I looked down the street to the left. The familiar old buildings were still standing, but they were no longer the trim, cream-colored structures which had once given that part of the city such a clean, orderly air. Most of them were burned out. Farther along on the right, the Theatinerkirche was masked with scaffolding. At the end of the street the Feldherren-Halle, Ludwig I’s copy of the
Loggia dei Lanzi, divested of its statuary, reared its columns in the midst of the desolation. It was gray and cool in the rooms of the MP building, but the place was crowded. Soldiers were everywhere and things seemed to be at sixes and sevens. After making several inquiries and being passed from one desk to another, I finally got hold of a brisk young sergeant to whom I explained my troubles. At first he said there wasn’t a chance of getting a ride out to Lucky Rear. Every jeep was tied up and would be for hours. They had just moved into Munich and hadn’t got things organized yet. Then all at once he relented and with a grin said, “Oh, you’re Navy, aren’t you? In that case I’ll have to fix you up somehow. We can’t have the Navy saying the Army doesn’t co- operate.” He walked over to a window that looked down on the courtyard below, shouted instructions to someone and then told me I’d find a jeep and driver outside. “Think nothing of it, Lieutenant,” he said in answer to my thanks. “Maybe I’ll be wanting a ship to take me home one of these days before long. Have to keep on the good side of the Navy.”
In the Kaiser Josef chamber of the Alt Aussee mine Karl Sieber and Lieutenant Kern view Michelangelo’s Madonna and Child, stolen from a church at Bruges. Lieutenants Kovalyak, Stout and Howe pack the Michelangelo Madonna for return to Bruges. The statue was restored to the Church of Notre Dame in September of 1945.
The famous Ghent altarpiece by van Eyck was flown from the Alt Aussee mine to Belgium in the name of Eisenhower as a token restitution. Karl Sieber, German restorer, Lieutenant Kern, American Monuments officer, and Max Eder, Austrian engineer, examine the panels of the Ghent altarpiece stored in the Alt Aussee mine.
On my way out I gathered up my luggage from the landing below and climbed into the waiting jeep. We turned the corner and followed the Prinz Regenten-Strasse to the river. I noticed for the first time that a temporary track had been laid along one side. This had been done, the driver said, in order to cart away the rubble which had accumulated in the downtown section. We turned right and followed the Isar for several blocks, crossed to the left over the Ludwig bridge, then drove out the Rosenheimer-Strasse to the east for a distance of about three miles. Our destination was the enormous complex of buildings called the Reichszeugmeisterei, or Quartermaster Corps buildings, in which the rear echelon of General Patton’s Third Army had just established its headquarters. Even in the baking sunlight of that June day, the place had a cold, unfriendly appearance. We halted for identification at the entrance, and there I was introduced to Third Army discipline. One of the guards gave me a black look and growled, “Put your cap on.” Startled by this burly order, I hastily complied and then experienced a feeling of extreme irritation at having been so easily cowed. I could at least have asked him to say “sir.” The driver, sensing my discomfiture, remarked good-naturedly, “You’ll get used to that sort of thing around here, sir. They’re very, very fussy now that the shooting’s over. Seems like they don’t have anything else to worry about, except enforcing a lot of regulations.” This was my first sample of what I learned to call by its popular name, “chicken”—a prudent abbreviation for the exasperating rules and regulations one finds at an Army headquarters. Third Army had its share of them—perhaps a little more than its share. But I didn’t find that out all at once. It took me all of two days. My driver let me out in front of the main building, over the central doorway of which the emblem of the Third Army was proudly displayed—a bold “A” inside a circle. The private at the information desk had never heard of the “Monuments, Fine Arts and Archives Section,” but said that if it was a part of G-5 it would be on the fifth floor. I found the office of the Assistant Chief of Staff and was directed to a room at the end of a corridor at least two blocks long. I was told that the officer I should see was Captain Robert Posey. I
knew that name from the reports I had studied at Versailles, as well as from a magazine article describing his discovery, months before, of some early frescoes in the little Romanesque church of Mont St. Martin which had been damaged by bombing. The article had been written by an old friend of mine, Lincoln Kirstein, who was connected with the MFA&A work in Europe. When I opened the door of the MFA&A office, George Stout was standing in the middle of the room. The expression of surprise on his face changed to relief after he had read the letter I handed him from Charlie Kuhn. “You couldn’t have arrived at a more opportune time,” he said. “I came down from Alt Aussee today to see Posey, but I just missed him. He left this morning for a conference in Frankfurt. I wanted to find out what had happened to the armed escort he promised me for my convoys. We’re evacuating the mine and desperately shorthanded, so I’ve got to get back tonight. It’s a six-hour drive.” “Charlie said you needed help. What do you want me to do?” I asked. I hoped he would take me along. “I’d like to have you stay here until we get this escort problem straightened out. I was promised two half-tracks, but they didn’t show up this morning. I’ve got a call in about them right now. It’s three o’clock. I ought to make Salzburg by five-thirty. There’ll surely be some word about the escort by that time, and I’ll phone you from there.” Before he left, George introduced me to Lieutenant Colonel William Hamilton, the Assistant Chief of Staff, and explained to him that I had come down on special orders from SHAEF to help with the evacuation work. George told the colonel that I would be joining him at the mine as soon as Captain Posey returned and provided me with the necessary clearance. After we had left Colonel Hamilton’s office, I asked George what he meant by “clearance.” He laughed and said that I would have to obtain a written permit from Posey before I could operate in Third Army territory. As Third Army’s Monuments Officer, Posey had absolute jurisdiction in all matters pertaining to the fine arts in the area occupied by his Army. At that
time it included a portion of Austria which later came under General Mark Clark’s command. “Don’t worry,” said George. “I’ll have you at the mine in a few days, and you’ll probably be sorry you ever laid eyes on the place.” I went back to the MFA&A office and was about to settle down at Captain Posey’s vacant desk. I looked across to a corner of the room where a lanky enlisted man sat hunched up at a typewriter. It was Lincoln Kirstein, looking more than ever like a world-weary Rachmaninoff. Lincoln a private in the U. S. Army! What a far cry from the world of modern art and the ballet! He was thoroughly enjoying my astonishment. “This is a surprise, but it explains a lot of things,” I said, dragging a chair over to his desk. “So you are the Svengali of the Fine Arts here at Third Army.” “You mustn’t say things like that around this headquarters,” he said apprehensively. During the next two hours we covered a lot of territory. First of all, I wanted to know why he was an enlisted man chained to a typewriter. With his extraordinary intelligence and wide knowledge of the Fine Arts, he could have been more useful as an officer. He said that he had applied for a commission and had been turned down. I was sorry I had brought up the subject, but knowing Lincoln’s fondness for the dramatic I thought it quite possible that he had wanted to be able to say in later years that he had gone through the war as an enlisted man. He agreed that he could have been of greater service to the Fine Arts project as an officer. Then I asked him what his “boss”—he was to be mine too—was like. He said that Captain Posey, an architect in civilian life, had had a spectacular career during combat. In the face of almost insurmountable obstacles, such as lack of personnel and transportation and especially the lack of any real co-operation from the higher-ups, he had accomplished miracles. Now that the press was devoting more and more space to the work the Monuments officers were doing—the discovery of treasures in salt mines and so
on—they were beginning to pay loving attention to Captain Posey around the headquarters. I gathered from Lincoln that the present phase of our activities appealed to the captain less than the protection and repair of historic monuments under fire. If true, this was understandable enough. He was an architect. Why would he, except as a matter of general cultural interest, find work that lay essentially in the domain of a museum man particularly absorbing? It seemed reasonable to assume that Captain Posey would welcome museum men to shoulder a part of the burden. But I was to learn later that my assumption was not altogether correct. Eventually I had to interrupt our conversation. It was getting late, and still no word about the escort vehicles. Lincoln told me where I would find the officer who was to have called George. He was Captain Blyth, a rough-and-ready kind of fellow, an ex-trooper from the state of Virginia. The outlook was not encouraging. No vehicles were as yet available. Finally, at six o’clock, he rang up to say that he wouldn’t know anything before morning. Lincoln returned from chow, I gave him the message in case George called while I was out and went down to eat. It was after eight when George telephoned. The connection from Salzburg was bad, and so was his temper when I told him I had nothing to report. Lincoln usually spent his evenings at the office. That night we stayed till after eleven. Here and there he had picked up some fascinating German art books and magazines, all of them Nazi publications lavishly illustrated. They bore eloquent testimony to Hitler’s patronage of the arts. The banality of the contemporary work in painting was stultifying—dozens of rosy-cheeked, buxom maidens and stalwart, brown-limbed youths reeking with “strength through joy,” and acres of idyllic landscapes. The sculpture was better, though too often the tendency toward the colossal was tiresomely in evidence. It was in recording the art of the past, notably in the monographs dealing with the great monuments of the Middle Ages and the Baroque, that admirable progress had been made. I asked
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

Get PostgreSQL Server Programming - Second Edition Dar free all chapters

  • 1.
    Download the FullVersion of textbook for Fast Typing at textbookfull.com PostgreSQL Server Programming - Second Edition Dar https://textbookfull.com/product/postgresql-server- programming-second-edition-dar/ OR CLICK BUTTON DOWNLOAD NOW Download More textbook Instantly Today - Get Yours Now at textbookfull.com
  • 2.
    Recommended digital products(PDF, EPUB, MOBI) that you can download immediately if you are interested. Learn PostgreSQL - Second Edition -.- https://textbookfull.com/product/learn-postgresql-second-edition/ textboxfull.com PostgreSQL 9 Administration Cookbook - Second Edition Simon Riggs https://textbookfull.com/product/postgresql-9-administration-cookbook- second-edition-simon-riggs/ textboxfull.com DaR Darverius House of DaR 1 1st Edition Jennifer Julie Miller https://textbookfull.com/product/dar-darverius-house-of-dar-1-1st- edition-jennifer-julie-miller/ textboxfull.com PostgreSQL High Availability Cookbook Master over 100 recipes to design and implement a highly available server with the advanced features of PostgreSQL 2nd Edition Shaun M. Thomas https://textbookfull.com/product/postgresql-high-availability- cookbook-master-over-100-recipes-to-design-and-implement-a-highly- available-server-with-the-advanced-features-of-postgresql-2nd-edition- shaun-m-thomas/ textboxfull.com
  • 3.
    Windows Server 2016cookbook Second Edition Krause https://textbookfull.com/product/windows-server-2016-cookbook-second- edition-krause/ textboxfull.com Hands-on Microsoft Windows Server 2016 Second Edition. Edition Palmer https://textbookfull.com/product/hands-on-microsoft-windows- server-2016-second-edition-edition-palmer/ textboxfull.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/ textboxfull.com Learn Python Programming Second Edition Fabrizio Romano https://textbookfull.com/product/learn-python-programming-second- edition-fabrizio-romano/ textboxfull.com Foundations of Programming Languages Second Edition Lee https://textbookfull.com/product/foundations-of-programming-languages- second-edition-lee/ textboxfull.com
  • 6.
    Table of Contents PostgreSQLServer Programming Second Edition Credits About the Authors About the Reviewers www.PacktPub.com Support files, eBooks, discount offers, and more Why subscribe? Free access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions 1. What Is a PostgreSQL Server? Why program in the server? Using PL/pgSQL for integrity checks About this book's code examples Switching to the expanded display Moving beyond simple functions Data comparisons using operators Managing related data with triggers Auditing changes Data cleaning Custom sort orders Programming best practices KISS – keep it simple stupid
  • 7.
    DRY – don'trepeat yourself YAGNI – you ain't gonna need it SOA – service-oriented architecture Type extensibility Caching Wrapping up – why program in the server? Performance Ease of maintenance Improved productivity Simple ways to tighten security Summary 2. Server Programming Environments Cost of acquisition Availability of developers Licensing Predictability Community Procedural languages Third-party tools Platform compatibility Application design Databases are considered harmful Encapsulation What does PostgreSQL offer? Data locality More basics Transactions General error reporting and error handling User-defined functions Other parameters More control Summary 3. Your First PL/pgSQL Function Why PL/pgSQL? The structure of a PL/pgSQL function Accessing function arguments
  • 8.
    Conditional expressions Loops withcounters Statement termination Looping through query results PERFORM versus SELECT Looping Through Arrays Returning a record Acting on the function's results Summary 4. Returning Structured Data Sets and arrays Returning sets Returning a set of integers Using a set returning function Functions based on views OUT parameters and records OUT parameters Returning records Using RETURNS TABLE Returning with no predefined structure Returning SETOF ANY Variadic argument lists A summary of the RETURN SETOF variants Returning cursors Iterating over cursors returned from another function Wrapping up of functions returning cursors Other ways to work with structured data Complex data types for the modern world – XML and JSON XML data type and returning data as XML from functions Returning data in the JSON format Summary 5. PL/pgSQL Trigger Functions Creating the trigger function Creating the trigger Working on a simple "Hey, I'm called" trigger The audit trigger
  • 9.
    Disallowing DELETE Disallowing TRUNCATE Modifyingthe NEW record The timestamping trigger The immutable fields trigger Controlling when a trigger is called Conditional triggers Triggers on specific field changes Visibility Most importantly – use triggers cautiously! Variables passed to the PL/pgSQL TRIGGER function Summary 6. PostgreSQL Event Triggers Use cases for creating event triggers Creating event triggers Creating an audit trail Preventing schema changes A roadmap of event triggers Summary 7. Debugging PL/pgSQL Manual debugging with RAISE NOTICE Throwing exceptions Logging to a file The advantages of RAISE NOTICE The disadvantages of RAISE NOTICE Visual debugging Installing the debugger Installing the debugger from the source Installing pgAdmin3 Using the debugger The advantages of the debugger The disadvantages of the debugger Summary 8. Using Unrestricted Languages Are untrusted languages inferior to trusted ones? Can you use untrusted languages for important functions?
  • 10.
    Will untrusted languagescorrupt the database? Why untrusted? Why PL/Python? Quick introduction to PL/Python A minimal PL/Python function Data type conversions Writing simple functions in PL/Python A simple function Functions returning a record Table functions Running queries in the database Running simple queries Using prepared queries Caching prepared queries Writing trigger functions in PL/Python Exploring the inputs of a trigger A log trigger Constructing queries Handling exceptions Atomicity in Python Debugging PL/Python Using plpy.notice() to track the function's progress Using assert Redirecting sys.stdout and sys.stderr Thinking out of the "SQL database server" box Generating thumbnails when saving images Sending an e-mail Listing directory contents Summary 9. Writing Advanced Functions in C The simplest C function – return (a + b) add_func.c Version 0 call conventions Makefile CREATE FUNCTION add(int, int) add_func.sql.in
  • 11.
    Summary for writinga C function Adding functionality to add(int, int) Smart handling of NULL arguments Working with any number of arguments Basic guidelines for writing C code Memory allocation Use palloc() and pfree() Zero-fill the structures Include files Public symbol names Error reporting from C functions "Error" states that are not errors When are messages sent to the client? Running queries and calling PostgreSQL functions A sample C function using SPI Visibility of data changes More info on SPI_* functions Handling records as arguments or returned values Returning a single tuple of a complex type Extracting fields from an argument tuple Constructing a return tuple Interlude – what is Datum? Returning a set of records Fast capturing of database changes Doing something at commit/rollback Synchronizing between backends Writing functions in C++ Additional resources for C Summary 10. Scaling Your Database with PL/Proxy Creating a simple single-server chat Dealing with success – splitting tables over multiple databases What expansion plans work and when? Moving to a bigger server Master-slave replication – moving reads to slave Multimaster replication
  • 12.
    Data partitioning acrossmultiple servers Splitting the data PL/Proxy – the partitioning language Installing PL/Proxy The PL/Proxy language syntax CONNECT, CLUSTER, and RUN ON SELECT and TARGET SPLIT – distributing array elements over several partitions The distribution of data Configuring the PL/Proxy cluster using functions Configuring the PL/Proxy cluster using SQL/MED Moving data from the single to the partitioned database Connection Pooling Summary 11. PL/Perl – Perl Procedural Language When to use PL/Perl Installing PL/Perl A simple PL/Perl function Passing and returning non-scalar types Writing PL/Perl triggers Untrusted Perl Summary 12. PL/Tcl – Tcl Procedural Language Installing PL/Tcl A simple PL/Tcl function Null checking with Strict functions The parameter format Passing and returning arrays Passing composite-type arguments Accessing databases Writing PL/Tcl triggers Untrusted Tcl Summary 13. Publishing Your Code as PostgreSQL Extensions When to create an extension Unpackaged extensions
  • 13.
    Extension versions The .controlfile Building an extension Installing an extension Viewing extensions Publishing your extension Introduction to PostgreSQL Extension Network Signing up to publish your extension Creating an extension project the easy way Providing the metadata about the extension Writing your extension code Creating the package Submitting the package to PGXN Installing an extension from PGXN Summary 14. PostgreSQL as an Extensible RDBMS What can't be extended? Creating a new operator Overloading an operator Optimizing operators COMMUTATOR NEGATOR Creating index access methods Creating user-defined aggregates Using foreign data wrappers Summary Index
  • 14.
  • 15.
    PostgreSQL Server Programming SecondEdition Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: June 2013 Second edition: February 2015 Production reference: 1210215 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
  • 16.
  • 17.
    Credits Authors Usama Dar Hannu Krosing JimMlodgenski Kirk Roybal Reviewers Stephen Frost Rick van Hattem Vibhor Kumar Jeff Lawson Mariano Reingart Julien Tachoires Commissioning Editor Usha Iyer Acquisition Editors Antony Lowe Meeta Rajani Sam Wood
  • 18.
    Content Development Editor AdrianRaposo Technical Editors Mrunmayee Patil Chinmay Puranik Copy Editors Dipti Kapadia Aarti Saldanha Project Coordinator Kinjal Bari Proofreaders Maria Gould Linda Morris Indexer Monica Ajmera Mehta Production Coordinator Nitesh Thakur Cover Work Nitesh Thakur
  • 19.
    About the Authors UsamaDar is a seasoned software developer and architect. During his 14 years' career, he has worked extensively with PostgreSQL and other database technologies. He worked on PostgreSQL internals extensively while he was working for EnterpriseDB. Currently, he lives in Munich where he works for Huawei's European Research Center. He designs the next generation of high-performance database systems based on open source technologies, such as PostgreSQL, which are used under high workloads and strict performance requirements. Hannu Krosing was a PostgreSQL user before it was rewritten to use SQL as its main query language in 1995. Therefore, he has both the historic perspective of its development, as well as almost 20 years of experience in using it to solve various real-life problems. He was the first database administrator and database architect at Skype, where he invented the sharding language PL/Proxy that allows you to scale the user database in order to work with billions of users. After he left Skype at the end of 2006—about a year after it was bought by eBay—he has been working as a PostgreSQL consultant with 2ndQuadrant, the premier PostgreSQL consultancy with a global reach and local presence in most parts of the world. He has coauthored PostgreSQL 9 Administration Cookbook, Packt Publishing, together with one of the main PostgreSQL developers, Simon Riggs. I want to sincerely thank my wife, Evelyn, for her support while writing this book.
  • 20.
    Jim Mlodgenski isthe CTO of OpenSCG, a professional services company focused on leveraging open source technologies for strategic advantage. He was formerly the CEO of StormDB, a database cloud company focused on horizontal scalability. Prior to StormDB, he has held highly technical roles at Cirrus Technology, Inc., EnterpriseDB, and Fusion Technologies. Jim is also a fervent advocate of PostgreSQL. He is on the board of the United States PostgreSQL Association as well as a part of the organizing teams of the New York PostgreSQL User Group and Philadelphia PostgreSQL User Group. Kirk Roybal has been an active member of the PostgreSQL community since 1998. He has helped organize user groups in Houston, Dallas, and Bloomington, IL. He has mentored many junior database administrators and provided cross-training to senior database engineers. He has provided solutions using PostgreSQL for reporting, business intelligence, data warehousing, applications, and development support. He saw the scope of PostgreSQL when his first small-scale business customer asked for a web application. At that time, competitive database products were either extremely immature or cost prohibitive. Kirk has stood by his choice of PostgreSQL for many years now. His expertise is founded on keeping up with features and capabilities as they become available. Writing a book has been a unique experience for me. Many people fantasize about it, few start one, and even fewer get to publication. I am proud to be part of a team that actually made it to the book shelf (which itself is a diminishing breed). Thanks to Sarah Cullington from Packt Publishing for giving me a chance to participate in the project. I believe that the PostgreSQL
  • 21.
    community will bebetter served by this information, and I hope that they receive this as a reward for the time that they have invested in me over the years. A book only has the value that the readers give it. Thank you to the PostgreSQL community for all the technical, personal, and professional development help you have provided. The PostgreSQL community is a great bunch of people, and I have enjoyed the company of many of them. I hope to contribute more to this project in the future, and I hope you find my contributions as valuable as I find yours. Thank you to my family for giving me a reason to succeed and for listening to the gobbledygook and nodding appreciatively. Have you ever had your family ask you what you were doing and answered them with a function? Try it. No, then again, don't try it. They may just have you involuntarily checked in somewhere.
  • 22.
    About the Reviewers StephenFrost is a major contributor and committer to PostgreSQL, who has been involved with PostgreSQL since 2002, and has developed features such as the role system and column-level privileges. He is the chief technology officer at Crunchy Data Solutions, Inc., the PostgreSQL company for Secure Enterprises. He is involved in the advancement of PostgreSQL's capabilities, particularly in the area of security in order to support the needs of government and financial institutions who have strict security and regulatory requirements. Rick van Hattem is an entrepreneur with a computer science background and a long-time open source developer with vast experience in the C, C++, Python, and Java languages. Additionally, he has worked with most large database servers such as Oracle, MS SQL, and MySQL, but he has been focusing on PostgreSQL since Version 7.4. He is one of the founders of the Fashiolista.com social network, and until recently, he was the CTO. Here, he used PostgreSQL to scale the feeds for millions of users to show that PostgreSQL can hold up to NoSQL solutions, given some tuning and additional tools. After Fashiolista, he worked as a freelance consultant for several companies, including 2ndQuadrant. He is currently the founder of PGMon.com, a monitoring service that analyzes your databases, indexes, and queries to keep them running at peak performance. In addition to analyzing your database settings, the system actively monitors your queries and gives you recommendations to enhance performance. He is also the creator and maintainer of a large number of open source projects, such as pg_query_analyser, pg_cascade_timestamp,
  • 23.
    QtQuery, Python-Statsd, andDjango-Statsd. Vibhor Kumar is a principal system architect at EnterpriseDB who specializes in assisting Fortune 100 companies to deploy, manage, and optimize Postgres databases. He joined EnterpriseDB in 2008 to work with Postgres after several years of working with Oracle systems. He has worked in team leadership roles at IBM Global Services and BMC Software as well as an Oracle database administrator at CMC Ltd. for several years. He has developed expertise in Oracle, DB2, and MongoDB and holds certifications in them. He has experience working with MS SQL Server, MySQL, and data warehousing. He holds a bachelor's degree in computer science from the University of Lucknow and a master's degree in computer science from the Army Institute of Management, Kolkata. He is a certified PostgreSQL trainer and holds a professional certification in Postgres Plus Advanced Server from EnterpriseDB. Jeff Lawson has been a fan and user of PostgreSQL since the time he discovered it in 2001. Over the years, he has also developed and deployed applications for IBM DB2, Oracle, MySQL, Microsoft SQL Server, Sybase, and others, but he always prefers PostgreSQL for its balance of features and openness. Much of his experience involves developing for Internet-facing websites/projects that require highly scalable databases with high availability or with provisions for disaster recovery. He currently works as the director of software development for FlightAware, which is an airplane-tracking website that uses PostgreSQL and other open source software to store and analyze the positions of the thousands of flights that are operated worldwide every day. He has extensive experience in software architecture, data security, and network protocol design from the software engineering positions he has held at Univa / United Devices, Microsoft, NASA's Jet Propulsion Laboratory, and WolfeTech. He is a founder of distributed.net, which pioneered distributed computing in the 1990s, and he continues to serve as the chief of operations and
  • 24.
    as a memberof the board there. He earned a BSc degree in computer science from Harvey Mudd College. He is fond of cattle, holds an FAA private pilot certificate, and owns an airplane based in Houston, Texas. Mariano Reingart lives in Buenos Aires, Argentina, and is a specialist in the software development of applications and libraries (web services, PDF, GUI, replication, and so on) with more than 10 years of experience. Currently, he is the PostgreSQL regional contact for Argentina and a Python Software Foundation member. He is a major contributor to the web2py Python web framework, and now he's working on the wxWidgets multiplatform GUI toolkit (specifically in the Qt port and Android mobile areas). Also, he has contributed to more than a dozen open source projects, including an interface for Free Electronic Invoice web services (PyAfipWs) and Pythonic replication for PostgreSQL (PyReplica). He has a bachelor's degree in computer systems analysis, and currently, he's a master's candidate for the MSc in free software degree at the Open University of Catalonia. He works on his own funded entrepreneurial venture formed by an open group of independent professionals, dedicated to software development, training, and technical support, focusing on open source tools (GNU/Linux, Python, PostgreSQL, and web2py/wxPython). He has worked for local Python-based companies in large business applications (ERP, SCM, and CRM) and mission critical systems (election counting, electronic voting, and 911 emergency events support). He has contributed to books such as web2py Enterprise Web Framework, Third Edition, and web2py Application Development Cookbook, Packt Publishing, and several Spanish translations of the PostgreSQL official documentation.
  • 25.
    His full resumeis available at http://reingart.blogspot.com/p/resume.html. Julien Tachoires is a PostgreSQL specialist, who works as consultant for the French PostgreSQL company Dalibo. He is the main developer of pg_activity, a top-end software dedicated to follow the PostgreSQL incoming traffic in real time, which is written in Python. I want to thank my employer Dalibo; my wife, Camille; and my son, Arthur.
  • 26.
    www.PacktPub.com Support files, eBooks, discountoffers, and more For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <service@packtpub.com> for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content
  • 27.
    On demand andaccessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
  • 28.
    Preface This fascinating guideto server programming will take your skills of PostgreSQL to a whole new level. A step-by-step approach with illuminating examples will educate you about the full range of possibilities. You will understand the extension framework of PostgreSQL and leverage it in ways you haven't even invented yet. You will learn how to write functions and create your own data types, all in your favorite programming language. It is a step-by-step tutorial, with plenty of tips and tricks to kick-start server programming.
  • 29.
    What this bookcovers Chapter 1, What Is a PostgreSQL Server?, introduces you to the PostgreSQL server and will set the tone for the rest of the book. It introduces you to the ways in which a PostgreSQL server is extendible, and shows you that it can be treated as a complete software development framework instead of just a database server. Chapter 2, Server Programming Environments, elaborates that PostgreSQL is built to handle user needs, but more importantly, it is built not to change underneath users in the future. It will touch upon the environments and will highlight some of the important things to be kept in mind when programming on the server in PostgreSQL. Chapter 3, Your First PL/pgSQL Function, builds the foundations by demonstrating how to write simple PL/pgSQL functions. Chapter 4, Returning Structured Data, builds on the knowledge of writing PL/pgSQL functions and demonstrates how to write functions that return a set of values such as rows, arrays, and cursors. Chapter 5, PL/pgSQL Trigger Functions, discusses how to write PL/pgSQL functions that are used to write trigger logic. It also discusses the various types of triggers available in PostgreSQL and the options that a database developer has when writing such functions. Chapter 6, PostgreSQL Event Triggers, discusses PostgreSQL's event trigger functionality. Event triggers are fired when running a DDL operation on a table. This chapter discusses the various possibilities and options of creating event triggers and their limitations in PostgreSQL. Chapter 7, Debugging PL/pgSQL, elaborates on how to debug PL/pgSQL's stored procedures and functions in PostgreSQL. This
  • 30.
    chapter explains howto install the debugger plugin and use the pgAdmin debugger console. Chapter 8, Using Unrestricted Languages, explains the differences between restricted and unrestricted PostgreSQL languages. This chapter uses PL/Python as an example and demonstrates the examples of both restricted and unrestricted functions in PL/Python. Chapter 9, Writing Advanced Functions in C, explains how to extend PostgreSQL by writing user-defined functions (UDFs) in C. Chapter 10, Scaling Your Database with PL/Proxy, explains the use of a special programming language in PostgreSQL called PL/Proxy and how to use it in order to partition and shard your database. Chapter 11, PL/Perl – Perl Procedural Language, discusses a popular PL language in PostgreSQL called PL/Perl. This chapter uses some simple examples to demonstrate how you can use Perl to write database functions. Chapter 12, PL/Tcl – Tcl Procedural Language, discusses Tcl as a language of choice when writing database functions. It discusses the pros and cons of using Tcl in the database. Chapter 13, Publishing Your Code as PostgreSQL Extensions, discusses how to package and distribute the PostgreSQL extensions. Well-packaged extensions can be easily distributed and installed by other users. This chapter also introduces you to the PostgreSQL Extension Network (PGXN) and shows you how to use it to get the extensions published by other developers. Chapter 14, PostgreSQL as an Extensible RDBMS, discusses more extensibility options in PostgreSQL, such as creating new data types, operators, and index methods.
  • 31.
    What you needfor this book In order to follow this book, you need the following software: PostgreSQL Database Server 9.4 Linux/Unix Operating System Python 2, Perl, and Tcl
  • 32.
    Who this bookis for This book is for moderate to advanced level PostgreSQL database professionals. To get a better understanding of this book, you should have a general experience in writing SQL, a basic idea of query tuning, and some coding experience in a language of your choice.
  • 33.
    Conventions In this book,you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "If any of the checks fail, you should do ROLLBACK instead of COMMIT." A block of code is set as follows: CREATE TABLE accounts(owner text, balance numeric, amount numeric); INSERT INTO accounts VALUES ('Bob',100); INSERT INTO accounts VALUES ('Mary',200); When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: CREATE OR REPLACE FUNCTION fibonacci_seq(num integer) RETURNS SETOF integer AS $$ DECLARE a int := 0; b int := 1; BEGIN IF (num <= 0) THEN RETURN; END IF;
  • 34.
    Another Random ScribdDocument with Unrelated Content
  • 35.
    After making severalinquiries, we eventually located a small house on the edge of town. In response to our insistent hammering, the door of the house was finally opened by a pallid young man probably in his late twenties. If he was the object of the captain’s search he had certainly undergone a remarkable metamorphosis, for he bore little resemblance to the dapper officer of whom Captain Vassalle carried a photograph for identification. The captain seemed satisfied that he was the man. So leaving them in conversation, the three of us followed up the business of the reported works of art. The other two occupants of the house—an old man and a young woman who may have been the wife of the man who had opened the door— responded to our questions with alacrity and took us to the cellar. There we were shown a cache of pictures, all of them unframed and none of them of any value. They appeared to be what the old man claimed—their own property, brought to Bad Brückenau when they had left Frankfurt to escape the bombings. In any case, we made a listing of the canvases, identifying them as best we could and making notations of the sizes, and also admonishing the couple not to remove them from the premises. After that the old man took us across the back yard to a large modern barn which was heavily padlocked. Once inside he unshuttered a row of windows along one side of the main, ground- floor room. It was jammed to the ceiling with every conceivable item of household furnishings: chairs, tables, beds, bedding, kitchen utensils and porcelain. But no pictures. We poked around enough to satisfy ourselves that first appearances were not deceiving. They weren’t, so, having made certain that the old fellow, who claimed to be merely the custodian of these things, understood the regulations forbidding their removal, we picked up Captain Vassalle. He had completed his interrogation of the alleged SS officer and placed him under house arrest. Our next objective was an old Schloss which, according to our map, was still a good hour’s drive to the northeast. As it was nearly noon and we were all hungry, we decided to investigate the possibilities of food in the neighborhood. On our way back through Bad Brückenau we stopped at the office of a small detachment of
  • 36.
    troops and askedwhere we could get some lunch. The hospitable second lieutenant on duty in the little stucco building, which had once been part of the Kurhaus establishment, gave us directions to the sprawling country hotel, high up above the town, where his outfit was quartered. He said that he would telephone ahead to warn the mess sergeant of our arrival. For a little way we followed along the Sinn, which flows through the grassy valley in which Bad Brückenau nestles. Then we began to mount sharply and, for the next fifteen minutes, executed a series of hairpin turns and ended abruptly beside a rambling structure which commanded a wonderful view of the valley and the wooded hills on the other side. Our hosts were a group of friendly young fellows who seemed delighted to have the monotony of their rural routine interrupted by our visit. They asked Charlie and me the usual question—what was the Navy doing in the middle of Germany—and got our stock reply: we are planning to dig a canal from the North Sea to the Mediterranean. We had a heavy downpour during lunch, and we waited for the rain to let up before starting out again. Then we took the winding road down into town, crossed the river and drove up into the hills on the other side of the valley. An hour’s drive brought us to upland meadow country and a grove of handsome lindens. At the end of a long double row of these fine trees stood Schloss Rossbach. “Castle” was a rather pompous name for the big seventeenth century country house with whitewashed walls and heavily barred ground- floor windows. We were received by the owners, a Baron Thüngen and his wife, and explained that we had come to examine the condition of the works of art, which, according to our information, had been placed there for safekeeping. They ushered us up to a comfortable sitting room on the second floor where we settled down to wait while the baroness went off to get the keys. In the meantime we had a few words with her husband. His manner was that of the haughty landed proprietor, and he looked the part. He was a big, burly man in his sixties. He was dressed in rough tweeds and wore a matching hat, adorned with a bushy “shaving brush,” which he hadn’t bothered to
  • 37.
    remove indoors. Thatmay have been unintentional, but I idly wondered if it weren’t deliberate discourtesy and rather wished that I had kept my own cap on. I wished also that I could have matched his insolent expression, but thought it unlikely because I was frankly enjoying the obvious distaste which our visit was causing the old codger. However, his attitude was almost genial compared with that of his waspish wife, who reappeared about that time, armed with a huge hoop from which a great lot of keys jangled. The baroness, who was much younger than her husband, had very black hair and discontented dark eyes. She spoke excellent English, without a trace of accent. I felt reasonably sure that she was not German but couldn’t guess her nationality. It turned out that she was from the Argentine. She was a sullen piece and made no effort to conceal her irritation at our intrusion. She explained that neither she nor her husband had anything to do with the things stored there; that, in fact, it was a great inconvenience having to put up with them. She had asked the young woman who knew all about them to join us. The young woman in question arrived and was completely charming. She took no apparent notice of the baroness’ indifference, which was that of a mistress toward a servant whom she scarcely knew. Her fresh, open manner cleared the atmosphere instantly. She introduced herself as Frau Holzinger, wife of the director of Frankfurt’s most famous museum, the Staedelsches Kunstinstitut. Because of conditions in Frankfurt, and more particularly because their house had been requisitioned by the American military authorities, she had come to Schloss Rossbach with her two young children. Country life, she continued, was better for the youngsters and, besides, her husband had thought that she might help with the things stored at the castle. I had met Dr. Holzinger when I went one day to have a look at what remained of the museum, so his wife and I hit it off at once. I was interested to learn that she was Swiss and a licensed physician. She smilingly suggested that we make a tour of the castle and she would show us what was there. The first room to be inspected was a library adjoining the sitting room in which we had been waiting. Here we found a quantity of
  • 38.
    excellent French Impressionistpaintings, all from the permanent collection of the Staedel, and a considerable number of fine Old Master drawings. Most of these were likewise the property of the museum, but a few—I remember one superb Rembrandt sketch— appeared to have come from Switzerland. Those would, of course, have to be looked into later, to determine their exact origin and how they came to be on loan at the museum. But for the moment we were concerned primarily with storage conditions and the problem of security. In another room we found an enormous collection of books, the library of one of the Frankfurt museums. In a third we encountered an array of medieval sculpture—saints of all sizes and description, some of carved wood, others of stone, plain or polychromed. These too were of museum origin. The last storage room was below ground, a vast, cavernous chamber beneath the house. Here was row upon row of pictures, stacked in two tiers down the center of the room and also along two sides. From what we could make of them in the poor light, they were not of high quality. During the summer months they would be all right in this underground room, but we thought that the place would be very damp in the winter. Frau Holzinger assured us that this was so and that the pictures should be removed before the bad weather set in. The baroness chipped in at this point and affably agreed with that idea, undoubtedly happy to further any scheme which involved getting rid of these unwelcome objects. She also warned us that the castle was far from safe as it was, what with roving bands of Poles all over the countryside. As we indicated that we were about to take our leave, she elaborated upon this theme, declaring that their very lives were in danger, that every night she and her husband could hear prowlers in the park. Since they—as Germans—were not allowed to have firearms, they would be at the mercy of these foreign ruffians if they should succeed in breaking into the castle. By this time we were all pretty fed up with the whining baroness. As we turned to go, Charlie Kuhn, eyeing her coldly, asked, “Who brought those Poles here in the first place, madam? We didn’t.”
  • 39.
    To our delight,the weather had cleared and the sun was shining. Ahead of us on the roadway, the foliage of the lindens made a gaily moving pattern. Our work for the day was done and we still had half the afternoon. I got out the map and, after making some quick calculations, proposed that we could take in Würzburg and still get back to Frankfurt at a reasonable hour. We figured out that, with the extra jerry can of gas we had with us, we could just about make it. We would be able to fill up at Würzburg for the return trip. So, instead of continuing on the road back to Bad Brückenau, we turned south in the direction of Karlstadt. It was pleasant to be traveling a good secondary road instead of the broad, characterless Autobahn, on which there were no unexpected turns, no picturesque villages. There was little traffic, so we made very good time. In half an hour we had threaded our way through Karlstadt-on-the-Main. In this part of Franconia the Main is a capricious river, winding casually in and out of the gently undulating hills. A little later we passed the village of Veitschöchheim where the Prince-Bishops of Würzburg had an elaborate country house during the eighteenth century. The house still stands, and its gardens, with a tiny lake and grottoes in the Franco-Italian manner, remain one of the finest examples of garden planning of that day. As we drove by we were glad that this inviting spot had not attracted the attention of our bombers. Alas, such was not the case with Würzburg, as we realized the minute we reached its outskirts! The once-gracious city, surely one of the most beautiful in all Germany, was an appalling sight. Its broad avenues were now lined with nothing but the gaping, ruined remnants of the stately eighteenth century buildings which had lent the city an air of unparalleled distinction and consistency of design. High on its hilltop above the Main, the mellow walls of the medieval fortress of Marienberg caught the rays of the late afternoon sun. From the distance, the silhouette of that vast structure appeared unchanged, but the proud city of the Prince-Bishops which it overlooked was laid low. We drove slowly along streets not yet cleared of rubble, until we came to the Residenz, the great palace of the Prince-Bishops, those
  • 40.
    lavish patrons ofthe arts to whom the city owed so much of its former grandeur. This magnificent building, erected in the first half of the eighteenth century by the celebrated baroque architect, Johann Balthasar Neumann, for two Prince-Bishops of the Schönborn family, was now a ghost palace, its staring glassless windows and blackened walls pathetic vestiges of its pristine splendor. We walked up to the main entrance wondering if it could really be true that the crowning glory of the Residenz—the glorious ceiling by Tiepolo, representing Olympus and the Four Continents—was, as we had been told, still intact. With misgivings we turned left across the entrance hall to the Treppenhaus and mounted the grand staircase. We looked up and there it was—as dazzling and majestically beautiful as ever—that incomparable fresco, the masterpiece of the last great Italian painter. Someone with a far greater gift for words than I may be able to convey the exaltation one experiences on seeing that ceiling, not just for the first time but at any time. I can’t. It leaves artist and layman alike absolutely speechless. I think that, if I had to choose one great work of art, it would be this ceiling in the Residenz. You can have even the Sistine ceiling. I’ll take the Tiepolo. For the next half hour we examined every corner of it. Aside from a few minor discolorations, the result of water having seeped through the lower side of the vault just above the cornice, the fresco was undamaged. Considering the destruction throughout the rest of the building, I could not understand how this portion of the palace could be in such a remarkable state of preservation. The explanation was an interesting example of how good can sometimes come out of evil. Some forty years ago, as I remember the story, there was a fire in the Residenz. The wooden roof over a large portion, if not all, of the building was burned away. When it came to replacing the roof, the city fathers decided it would be a prudent idea to cover the part above the Tiepolo with steel and concrete. This was done, and consequently, when the terrible conflagration of March 1945 swept Würzburg—following the single raid of twenty minutes which destroyed the city—the fresco was spared. As we wandered through other rooms of the Residenz—the Weisser Saal with its elaborate stucco ornamentation and the sumptuous Kaiser Saal facing the
  • 41.
    garden, once classicexamples of the Rococo—I wished that those city fathers had gone a little farther with their steel and concrete. We stopped briefly to examine the chapel in the south wing. Here, miraculously enough, there had been relatively little damage, but the caretaker expressed concern over the condition of the roof and said that if it weren’t repaired before the heavy rains the ceiling would be lost. Knowing how hard it was to obtain building materials for even the most historic monuments when people didn’t have a roof over their heads, we couldn’t reassure him with much conviction. The spectacle of ruined Würzburg had a depressing effect upon us, so we weren’t very talkative on our way back to Frankfurt. We passed through only one town of any size, Aschaffenburg, which, like Würzburg, had suffered severe damage. Although I had not been long in Germany and had seen but few of her cities, I was beginning to realize that the reports of the Allied air attacks had not been exaggerated. I was ready to believe that there were only small towns and villages left in this ravaged country. One morning Charlie Kuhn rang up to say that I should meet him at the Reichsbank early that afternoon. This was something I had been looking forward to for some time, the chance to look at the wonderful things from the Merkers mine which were temporarily stored there. With Charlie came two members of the MFA&A organization whom I had not seen since Versailles and then only briefly. They had been stationed at Barbizon, as part of the Allied Group Control Council for Germany (usually referred to simply as “Group CC”) the top level policy-making body as opposed to SHAEF, which dealt with the operational end of things. These two gentlemen were John Nicholas Brown, who had come over to Germany with the assimilated rank of colonel as General Eisenhower’s adviser on cultural affairs, and Major Mason Hammond, in civilian life professor of the Classics at Harvard. It had been decided, now that we were about to acquire a permanent depot in which to store the treasures, to make one Monuments officer responsible for the entire collection. By this transfer of custody, the Property Control Officer in whose charge the
  • 42.
    things were atpresent, could be relieved of that responsibility. Major Hammond had with him a paper designating me as custodian. Knowing in a general way what was stored in the bank, I felt that I was on the point of being made a sort of director, pro tem, of the Kaiser Friedrich Museum. The genial Property Control Officer, Captain William Dunn, was all smiles at the prospect of turning his burden over to someone else. But before this transfer could be made, a complete check of every item was necessary. Major Hammond knew just how he wanted this done. I was to have two assistants, who could come over the next morning from his office in Hoechst, twenty minutes from Frankfurt. The three of us, in company with Captain Dunn, would make the inventory. We wandered through the series of rooms in which the things were stored. In the first room were something like four hundred pictures lined up against the wall in a series of rows. In two adjoining rooms were great wooden cases piled one above another. In a fourth were leather-bound boxes containing the priceless etchings, engravings and woodcuts from the Berlin Print Room. Still another room was filled with cases containing the renowned Egyptian collections. It was rumored that one of them held the world-famous head of Queen Nefertete, probably the best known and certainly the most beloved single piece of all Egyptian sculpture. It had occupied a place of special honor in the Berlin Museum, in a gallery all to itself. Still other rooms were jammed with cases of paintings and sculpture of the various European schools. In a series of smaller alcoves were heaped huge piles of Oriental rugs and rare fabrics. And last, one enormous room with bookshelves was filled from floor to ceiling with some thirty thousand volumes from the Berlin Patent Office. Quite separate and apart from all these things was a unique collection of ecclesiastical vessels of gold and silver, the greater part of them looted from Poland. These extremely precious objects were kept in a special vault on the floor above.
  • 43.
    Captain Dunn broughtout a thick stack of papers. It was the complete inventory. Major Hammond said that the two officers who would help with the checking were a Captain Edwin Rae and a WAC lieutenant named Standen. Aside from having heard that Rae had been a student of Charlie Kuhn’s at Harvard, I knew nothing about him. But the name Standen rang a bell: was she, by any chance, Edith Standen who had been curator of the Widener Collection? Major Hammond smilingly replied, “The same.” I had known her years ago in Cambridge where we had taken Professor Sachs’ course in Museum Administration at the same time. I remembered her as a tall, dark, distinguished-looking English girl. To be exact, she was half English: her father had been a British Army officer, her mother a Bostonian. Recalling her very reserved manner and her scholarly tastes, I found it difficult to imagine her in uniform. Early the following morning, I met my cohorts at the entrance to the Reichsbank. I was pleasantly surprised to find that Captain Rae was an old acquaintance if not an old friend. He also had been around the Fogg Museum in my time. Edith looked very smart in her uniform. She had a brisk, almost jovial manner which was not to be reconciled with her aloof and dignified bearing in the marble halls of the Widener house at Elkins Park. We hunted up Captain Dunn and set to work. Our first task was to count and check off the paintings stacked in the main room. We got through them with reasonable speed, refraining with some difficulty from pausing to admire certain pictures we particularly fancied. Then we tackled the Oriental rugs, and that proved to be a thoroughly thankless and arduous task. We had a crew of eight PWs—prisoners of war—to help us spread the musty carpets out on the floor. Owing to the fact that the smaller carpets—in some cases they were hardly more than fragments—had been rolled up inside larger ones, we ended with nearly a hundred more items than the inventory called for. That troubled Captain Dunn a bit, but I told him that it didn’t matter so long as we were over. We’d have to start worrying only if we came out short. By five o’clock we were tired and dirty and barely a third of the way through with the job.
  • 44.
    The next daywe started in on the patent records. There had been a fire in the mine where the records were originally stored. Many of them were slightly charred, and all of them had been impregnated with smoke. When we had finished counting the whole thirty thousand, we smelled just the way they did. As a matter of fact we hadn’t wanted to assume responsibility for these records in the first place. Certainly they had nothing to do with art. But Major Hammond had felt that they properly fell to us as archives. And of course they were archives of a sort. On the morning of the third day, as I was about to leave my office for the Reichsbank, I had a phone call from Charlie Kuhn. He asked me how the work was coming along and then, in a guarded voice, said that something unexpected had turned up and that he might have to send me away for a few days. He told me he couldn’t talk about it on the telephone, and anyway, it wasn’t definite. He’d probably know by afternoon. I was to call him later. This was hardly the kind of conversation to prepare one for a humdrum day of taking inventory, even if one were counting real treasure. And for a person with my curiosity, the morning’s work was torture. When I called Charlie after lunch he was out but had left word that I was to come to his office at two o’clock. When I got there he was sitting at his desk. He looked up from the dispatch he was reading and said with a rueful smile, “Tom, I am going to send you out on a job I’d give my eyeteeth to have for myself.” Then he explained that certain developments had suddenly made it necessary to step up the work of evacuating art repositories down in Bavaria and in even more distant areas. For the first time in my life I knew what was meant by the expression “my heart jumped a beat”—for that was exactly what happened to mine! No wonder Charlie was envious. This sounded like the real thing. Charlie told me that I was to fly down to Munich the next morning and that I would probably be gone about ten days. To save time he had already had my orders cut. All I had to do was to pick them up at the AG office. I was to report to Third Army Headquarters and get in touch with George Stout as soon as possible. Charlie didn’t know just where I’d find George. He was out in the wilds somewhere. As a
  • 45.
    matter of facthe wasn’t too sure about the exact location of Third Army Headquarters. A new headquarters was being established and the only information he had was that it would be somewhere in or near Munich. The name, he said, would be “Lucky Rear” and I would simply have to make inquiries and be guided by signs posted along the streets. I asked Charlie what I should do about the completion of the inventory at the Reichsbank, and also about the impending report from the Corps of Engineers on the University of Frankfurt building. He suggested that I leave the former in Captain Rae’s hands and the latter with Lieutenant Buchman. Upon my return I could take up where I had left off. That evening I threw my things together, packing only enough clothes to see me through the next ten days. Not knowing where I would be billeted I took the precaution of including my blankets. Even at that my luggage was compact and light, which was desirable as I was traveling by air.
  • 46.
    (3) MUNICH AND THEBEGINNING OF FIELD WORK The next morning I was up before six and had early breakfast. It was a wonderful day for the trip, brilliantly clear. The corporal in our office took me out to the airfield, the one near Hanau where Craig Smyth and I had landed weeks before. It was going to be fun to see Craig again and find out what he had been up to since we had parted that morning in Bad Homburg. The drive to the airfield took about forty-five minutes. There was a wait of half an hour at the field, and it was after ten when we took off in our big C-47. We flew over little villages with red roofs, occasionally a large town—but none that I could identify—and now and then a silvery lake. Just before we reached Munich, someone said, “There’s Dachau.” Directly below us, on one side of a broad sweep of dark pine trees, we saw a group of low buildings and a series of fenced-in enclosures. On that sunny morning the place looked deserted and singularly peaceful. Yet only a few weeks before it had been filled with the miserable victims of Nazi brutality. In another ten minutes we landed on the dusty field of the principal Munich airport. Most of the administration buildings had a slightly battered look but were in working order. It was a welcome relief to take refuge from the blazing sunshine in the cool hallway of the main building. The imposing yellow brick lobby was decorated with painted shields of the different German states or “Länder.” The arms of Bavaria, Saxony, Hesse-Nassau and the rest formed a colorful frieze around the walls. A conveyance of some kind was scheduled to leave for town in a few minutes. Meanwhile there were sandwiches and coffee for the plane passengers. By the time we had finished, a weapons carrier had pulled up before the entrance. Several of us climbed into its
  • 47.
    dust-encrusted interior. Ittook me a little while to get my bearings as we drove toward Munich. I had spotted the familiar pepper-pot domes of the Frauenkirche from the air but had recognized no other landmark of the flat, sprawling city which I had known well before the war. It was not until we turned into the broad Prinz Regenten-Strasse that I knew exactly where I was. As we drove down this handsome avenue, I got a good look at a long, colonnaded building of white stone. The roof was draped with what appeared to be an enormous, dark green fishnet. The billowing scallops of the net flapped about the gleaming cornice of the building. It was the Haus der Deutschen Kunst, the huge exhibition gallery dedicated by Hitler in the middle thirties to the kind of art of which he approved—an art in which there was no place for untrammeled freedom of expression, only the pictorial and plastic representation of all the Nazi regime stood for. The dangling fishnet was part of the elaborate camouflage. I judged from the condition of the building that the net had admirably served its purpose. In a moment we rounded the corner by the Prinz Karl Palais. Despite the disfiguring coat of ugly olive paint which covered its classic façade, it had not escaped the bombs. The little palace, where Mussolini had stayed, had a hollow, battered look and the formal garden behind it was a waste of furrowed ground and straggling weeds. We turned left into the wide Ludwig-Strasse and came to a grinding halt beside a bleak gray building whose walls were pockmarked with artillery fire. I asked our driver if this were Lucky Rear headquarters and was told curtly that it wasn’t, but that it was the end of the line. It was MP headquarters and I’d have to see if they’d give me a car to take me to my destination, which the driver said was “’way the hell” on the other side of town. Before going inside I looked down the street to the left. The familiar old buildings were still standing, but they were no longer the trim, cream-colored structures which had once given that part of the city such a clean, orderly air. Most of them were burned out. Farther along on the right, the Theatinerkirche was masked with scaffolding. At the end of the street the Feldherren-Halle, Ludwig I’s copy of the
  • 48.
    Loggia dei Lanzi,divested of its statuary, reared its columns in the midst of the desolation. It was gray and cool in the rooms of the MP building, but the place was crowded. Soldiers were everywhere and things seemed to be at sixes and sevens. After making several inquiries and being passed from one desk to another, I finally got hold of a brisk young sergeant to whom I explained my troubles. At first he said there wasn’t a chance of getting a ride out to Lucky Rear. Every jeep was tied up and would be for hours. They had just moved into Munich and hadn’t got things organized yet. Then all at once he relented and with a grin said, “Oh, you’re Navy, aren’t you? In that case I’ll have to fix you up somehow. We can’t have the Navy saying the Army doesn’t co- operate.” He walked over to a window that looked down on the courtyard below, shouted instructions to someone and then told me I’d find a jeep and driver outside. “Think nothing of it, Lieutenant,” he said in answer to my thanks. “Maybe I’ll be wanting a ship to take me home one of these days before long. Have to keep on the good side of the Navy.”
  • 49.
    In the KaiserJosef chamber of the Alt Aussee mine Karl Sieber and Lieutenant Kern view Michelangelo’s Madonna and Child, stolen from a church at Bruges. Lieutenants Kovalyak, Stout and Howe pack the Michelangelo Madonna for return to Bruges. The statue was restored to the Church of Notre Dame in September of 1945.
  • 50.
    The famous Ghentaltarpiece by van Eyck was flown from the Alt Aussee mine to Belgium in the name of Eisenhower as a token restitution. Karl Sieber, German restorer, Lieutenant Kern, American Monuments officer, and Max Eder, Austrian engineer, examine the panels of the Ghent altarpiece stored in the Alt Aussee mine.
  • 51.
    On my wayout I gathered up my luggage from the landing below and climbed into the waiting jeep. We turned the corner and followed the Prinz Regenten-Strasse to the river. I noticed for the first time that a temporary track had been laid along one side. This had been done, the driver said, in order to cart away the rubble which had accumulated in the downtown section. We turned right and followed the Isar for several blocks, crossed to the left over the Ludwig bridge, then drove out the Rosenheimer-Strasse to the east for a distance of about three miles. Our destination was the enormous complex of buildings called the Reichszeugmeisterei, or Quartermaster Corps buildings, in which the rear echelon of General Patton’s Third Army had just established its headquarters. Even in the baking sunlight of that June day, the place had a cold, unfriendly appearance. We halted for identification at the entrance, and there I was introduced to Third Army discipline. One of the guards gave me a black look and growled, “Put your cap on.” Startled by this burly order, I hastily complied and then experienced a feeling of extreme irritation at having been so easily cowed. I could at least have asked him to say “sir.” The driver, sensing my discomfiture, remarked good-naturedly, “You’ll get used to that sort of thing around here, sir. They’re very, very fussy now that the shooting’s over. Seems like they don’t have anything else to worry about, except enforcing a lot of regulations.” This was my first sample of what I learned to call by its popular name, “chicken”—a prudent abbreviation for the exasperating rules and regulations one finds at an Army headquarters. Third Army had its share of them—perhaps a little more than its share. But I didn’t find that out all at once. It took me all of two days. My driver let me out in front of the main building, over the central doorway of which the emblem of the Third Army was proudly displayed—a bold “A” inside a circle. The private at the information desk had never heard of the “Monuments, Fine Arts and Archives Section,” but said that if it was a part of G-5 it would be on the fifth floor. I found the office of the Assistant Chief of Staff and was directed to a room at the end of a corridor at least two blocks long. I was told that the officer I should see was Captain Robert Posey. I
  • 52.
    knew that namefrom the reports I had studied at Versailles, as well as from a magazine article describing his discovery, months before, of some early frescoes in the little Romanesque church of Mont St. Martin which had been damaged by bombing. The article had been written by an old friend of mine, Lincoln Kirstein, who was connected with the MFA&A work in Europe. When I opened the door of the MFA&A office, George Stout was standing in the middle of the room. The expression of surprise on his face changed to relief after he had read the letter I handed him from Charlie Kuhn. “You couldn’t have arrived at a more opportune time,” he said. “I came down from Alt Aussee today to see Posey, but I just missed him. He left this morning for a conference in Frankfurt. I wanted to find out what had happened to the armed escort he promised me for my convoys. We’re evacuating the mine and desperately shorthanded, so I’ve got to get back tonight. It’s a six-hour drive.” “Charlie said you needed help. What do you want me to do?” I asked. I hoped he would take me along. “I’d like to have you stay here until we get this escort problem straightened out. I was promised two half-tracks, but they didn’t show up this morning. I’ve got a call in about them right now. It’s three o’clock. I ought to make Salzburg by five-thirty. There’ll surely be some word about the escort by that time, and I’ll phone you from there.” Before he left, George introduced me to Lieutenant Colonel William Hamilton, the Assistant Chief of Staff, and explained to him that I had come down on special orders from SHAEF to help with the evacuation work. George told the colonel that I would be joining him at the mine as soon as Captain Posey returned and provided me with the necessary clearance. After we had left Colonel Hamilton’s office, I asked George what he meant by “clearance.” He laughed and said that I would have to obtain a written permit from Posey before I could operate in Third Army territory. As Third Army’s Monuments Officer, Posey had absolute jurisdiction in all matters pertaining to the fine arts in the area occupied by his Army. At that
  • 53.
    time it includeda portion of Austria which later came under General Mark Clark’s command. “Don’t worry,” said George. “I’ll have you at the mine in a few days, and you’ll probably be sorry you ever laid eyes on the place.” I went back to the MFA&A office and was about to settle down at Captain Posey’s vacant desk. I looked across to a corner of the room where a lanky enlisted man sat hunched up at a typewriter. It was Lincoln Kirstein, looking more than ever like a world-weary Rachmaninoff. Lincoln a private in the U. S. Army! What a far cry from the world of modern art and the ballet! He was thoroughly enjoying my astonishment. “This is a surprise, but it explains a lot of things,” I said, dragging a chair over to his desk. “So you are the Svengali of the Fine Arts here at Third Army.” “You mustn’t say things like that around this headquarters,” he said apprehensively. During the next two hours we covered a lot of territory. First of all, I wanted to know why he was an enlisted man chained to a typewriter. With his extraordinary intelligence and wide knowledge of the Fine Arts, he could have been more useful as an officer. He said that he had applied for a commission and had been turned down. I was sorry I had brought up the subject, but knowing Lincoln’s fondness for the dramatic I thought it quite possible that he had wanted to be able to say in later years that he had gone through the war as an enlisted man. He agreed that he could have been of greater service to the Fine Arts project as an officer. Then I asked him what his “boss”—he was to be mine too—was like. He said that Captain Posey, an architect in civilian life, had had a spectacular career during combat. In the face of almost insurmountable obstacles, such as lack of personnel and transportation and especially the lack of any real co-operation from the higher-ups, he had accomplished miracles. Now that the press was devoting more and more space to the work the Monuments officers were doing—the discovery of treasures in salt mines and so
  • 54.
    on—they were beginningto pay loving attention to Captain Posey around the headquarters. I gathered from Lincoln that the present phase of our activities appealed to the captain less than the protection and repair of historic monuments under fire. If true, this was understandable enough. He was an architect. Why would he, except as a matter of general cultural interest, find work that lay essentially in the domain of a museum man particularly absorbing? It seemed reasonable to assume that Captain Posey would welcome museum men to shoulder a part of the burden. But I was to learn later that my assumption was not altogether correct. Eventually I had to interrupt our conversation. It was getting late, and still no word about the escort vehicles. Lincoln told me where I would find the officer who was to have called George. He was Captain Blyth, a rough-and-ready kind of fellow, an ex-trooper from the state of Virginia. The outlook was not encouraging. No vehicles were as yet available. Finally, at six o’clock, he rang up to say that he wouldn’t know anything before morning. Lincoln returned from chow, I gave him the message in case George called while I was out and went down to eat. It was after eight when George telephoned. The connection from Salzburg was bad, and so was his temper when I told him I had nothing to report. Lincoln usually spent his evenings at the office. That night we stayed till after eleven. Here and there he had picked up some fascinating German art books and magazines, all of them Nazi publications lavishly illustrated. They bore eloquent testimony to Hitler’s patronage of the arts. The banality of the contemporary work in painting was stultifying—dozens of rosy-cheeked, buxom maidens and stalwart, brown-limbed youths reeking with “strength through joy,” and acres of idyllic landscapes. The sculpture was better, though too often the tendency toward the colossal was tiresomely in evidence. It was in recording the art of the past, notably in the monographs dealing with the great monuments of the Middle Ages and the Baroque, that admirable progress had been made. I asked
  • 55.
    Welcome to ourwebsite – 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