1. Introduction to PL/pgSQL
Baji Shaik1 and Dinesh Kumar Chemuduru2
(1) (2)
Texas, TX, USA
Andhra Pradesh, India
In this chapter, we will start with an introduction of PL/pgSQL, on what is PL/pgSQL and what are the key features of it. We will talk about some common use cases where PL/pgSQL is used. PL/pgSQL comes by default when you install the PostgreSQL server. However, we will provide the steps to install PL/pgSQL. We will explain how PL/pgSQL works with a simple low diagram. We will show some basic examples of PL/pgSQL code blocks which are called anonymous and named code blocks.
A Closer Look at PL/pgSQL
PostgreSQL uses SQL (Structured Query Language) as a default query language. SQL is a common domain-speci ic language for relational databases. PostgreSQL uses some extensions and features to implement the standards of SQL. In addition to SQL, PostgreSQL supports many procedural languages like PL/pgSQL, PL/Java, PLV8, PL/Python, PL/Perl, etc. Using these languages, you can create functions, stored procedures, and triggers which will improve the performance by reducing the multiple iterations to the databases.
PL/pgSQL is the most commonly used procedural language in PostgreSQL. It is an extension of SQL. It is similar to Oracle's PL/SQL and supports features like control structures, exception handling, variables, loops, and conditional statements. These features help us to develop complex database applications in an ef icient way.
When working on designing a complex business logic inside the database, you would need to develop multiple SQLs which are sometimes interdependent. Results of one SQL will be used by other SQLs. In this case, running multiple SQLs increases the data low between the database and the client application and will cause performance bottlenecks due to high data transfer through the network. To overcome this, you can use stored procedures or functions.
PL/pgSQL supports stored procedures, functions, and triggers. A stored procedure is a set of precompiled SQL statements which can be executed repeatedly. Stored procedures can help to reduce network traf ic and improve performance by reducing the amount of data that needs to be sent between the database and the client application.
The common use cases to use stored procedures or functions using PL/pgSQL are
1. Improve data processing speed by using precompiled code through stored procedures which will be faster than raw SQL queries.
2. Write more complex code using features like control structures, exception handling, variables, loops, conditional statements, etc.
3. Using stored procedures or functions, you can create a reusable code to call from the applications to save time and effort.
4. PL/pgSQL is portable across different operating systems and platforms. This makes it easier to migrate code between different environments.
5. Prevent unauthorized access and data breaches by controlling the user authentication on stored procedures or functions.
6. Use triggers to implement constraints of business processes that cannot be expressed as foreign keys or check constraints.
PL/pgSQL Installation
PL/pgSQL is already included in PostgreSQL, so if you have PostgreSQL installed, you should have PL/pgSQL as well. However, you may need to
enable it if it is not already enabled. Here are the steps to enable PL/pgSQL in PostgreSQL:
1. Install PostgreSQL psql client to connect to the database, or you can use the pgAdmin client tool.
For Ubuntu, the following are the simple steps to install the client:
# Create the ile repository con iguration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -Ohttps://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package lists:
sudo apt-get update
# Install the latest version of PostgreSQL. If you want a speci ic version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql-client-15
For Linux (RHEL), you can follow the steps here: www.postgresql.org/download/linux/redhat/
2. Connect to the database and check if PL/pgSQL is already installed:
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description -----+---------+--------+-------------
(0 rows)
postgres=# select * from pg_extension where extname='plpgsql';
oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
(0 rows)
3. Execute the following command to enable PL/pgSQL:
postgres=# CREATE EXTENSION plpgsql; CREATE EXTENSION
4. Verify that PL/pgSQL is enabled by executing the following command:
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language (1 row)
JavaScript
postgres=# select * from pg_extension where extname='plpgsql';
oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
16388 | plpgsql | 10 | 11 | f | 1.0 | | (1 row)
PL/pgSQL Execution Flow
PL/pgSQL is like every other “loadable, procedural language.” PL/pgSQL gets loaded through a function manager called fmgr. The fmgr loads the language handler when a procedural language function or procedure is executed and calls it. The execution low of PL/pgSQL code is similar to that of other procedural programming languages, with parsing, compilation, execution, and cleanup stages. However, PL/pgSQL code is executed on the server side, which means that it has direct access to the database and can perform database operations more ef iciently than client-side code.
On the irst call of a PL/pgSQL function or procedure in a session, the server irst parses the code to check for syntax errors. The call handler will “compile” a function statement tree once the code is parsed. When the code is compiled, it turns into an internal form that the server can execute more ef iciently. SQL queries in the function are just kept as a string at this point, and the expressions like the following are actually SQL queries:
my_var := some_param * 10
The SQL queries are actually parsed at this point, and parser hooks are used to replace variables/parameters with PARAM nodes in the parse tree. The PL/pgSQL statement tree is very similar to a PostgreSQL execution tree. After the parse and compile, the call handler then executes that statement tree. On the irst execution of a statement node that has an SQL query in it, that query is prepared via the Server Programming Interface (SPI). The SPI provides a simple and ef icient way to execute SQL commands, retrieve query results, and manipulate the database. The compiled code is then executed by the server. Based on any variable and control structure declaration, the server creates a new execution environment for the PL/pgSQL code. If the PL/pgSQL code is a function or stored procedure that returns a result set, the server will send the result set back to the client. Once the execution of the code is complete, the server will clean up any resources that were used by the PL/pgSQL code, including variables and any temporary tables that were created.
Figure 1-1 represents the low of execution.
Figure 1-1 PL/pgSQL execution low
This diagram illustrates the high-level steps of the PL/pgSQL execution low. However, it's important to note that PL/pgSQL code can be quite complex and may include multiple control structures, error handling blocks, and nested and even recursive PL/pgSQL function calls and trigger invocations and database operations. The actual execution low of a speci ic PL/pgSQL function or stored procedure will depend on the speci ic code and logic used. This call hierarchy is not limited to
PL/pgSQL. All procedural languages share the common entry point of the fmgr, so they can be mixed and matched in trigger and function call stacks.
PL/pgSQL Blocks
PL/pgSQL is a block-structured language. The basic unit in any PL/pgSQL code is a block. All PL/pgSQL code is composed of a single block or blocks that occur either sequentially or nested within another block. There are two kinds of blocks:
Anonymous or unnamed blocks (DO) Named blocks (functions)
Anonymous or Unnamed Blocks
Anonymous or unnamed blocks are generally constructed dynamically and executed only once by the user. It is sort of a complex SQL statement. The following is the structure of an anonymous block, for example:
DO $$ [ <<label>> ] [ DECLARE -- Variable declaration here ] BEGIN
-- Execute statements here END [ label ]; $$; Now, let us start with a simple hello world code block, which does not have any name associated with it:
postgres=# DO $$ BEGIN
RAISE NOTICE 'Hello World'; END; $$;
NOTICE: Hello World DO
In the preceding example, the RAISE NOTICE command will help us to print the given message on the client console. As you can see here, the block is declared without a name, and if you want to print Hello World, then you have to repeat the same set of instructions again.
Now, let us print the Hello World line by line rather than in a single line:
postgres=# DO $o$ BEGIN
RAISE NOTICE $i$ Hello World $i$;
END; $o$;
NOTICE: Hello World DO
In the preceding example, we used different multiline speci iers. The whole block got enclosed by $o$, and the inner Hello World got enclosed by $i$. From this example, we can learn that in PL/pgSQL, we can have the nested multiliners, where each multiline should follow its own enclosure.
Now, let us write a nested BEGIN ... END inside a main BEGIN ... END block. Here is an example:
postgres=# DO $$ BEGIN BEGIN
RAISE NOTICE 'Hello World';
Another random document with no related content on Scribd:
jacket. Then I went back into hiding again. It wasn't any fun, hiding there, in all that uncertainty, and expecting every moment to see Mr. Zzyx coming up the steps.
"Then I heard a voice. Some one was calling me by name. Again, I climbed up on the stone, and peered over the ledge. I had only a second or two to see that it was Mr. McGinity calling, and to wave to him. It was long enough, however, and I never felt so relieved in my life before, as I thought my last hour had come."
Pat must have looked pretty ghastly when McGinity finally reached her side, according to what he told me afterwards. He had no idea, then, what had become of Mr. Zzyx, and was surprised not to encounter him inside the ruins.
I don't think either of them told me exactly what passed between them, when McGinity came to Pat's rescue. Perhaps it was too sacred to both of them to repeat, even for a devoted uncle's ears. Anyway, the reporter took her gently by the arm, and assisted her down the winding stairs. They had just reached the second landing when they heard Mr. Zzyx's labored breathing, as he came creeping up the steps below them.
Time was vital. McGinity's first thought was of Pat's safety. On this landing there was a closet in the wall, in which oil for the beacon lamp had been stored years ago. The heavy, studded oak door had defied the ravages of time. The hinges, though, were almost eaten away by rust. It required all the strength he possessed to open the door, and then to close it, once he had placed Pat inside. She was too frightened, it seems, to raise any protest against being shut up in the dark.
McGinity had just time to draw his revolver when Mr. Zzyx appeared at the top of the steps, and came at him, growling fiercely. He fired a shot to frighten off the creature, but it had not the slightest effect. Before he could get out of the way, Mr. Zzyx lunged at him in wild fury, caught him in his hairy arms, and held him with a grip like a vise. Luckily, his right arm was free, and he dealt the creature a heavy blow on the head with the butt of his revolver This not only broke the clinch; it frightened off the maddened beast.
With a bound, Mr Zzyx dashed up the steps to the peak of the ruins. McGinity quickly followed, firing three shots in the air in rapid succession. His idea all through had been to frighten and cow, and not to kill, and what occurred after they both reached the open landing certainly was not the act of wanton destruction on the reporter's part.
Mr. Zzyx wheeled, and rushed at the reporter. Again McGinity fired, a reckless shot. This time he stayed the onrush, and Mr. Zzyx turned in his tracks, leapt up on the dislodged stones, and gained the top ledge.
A wave of horror came over McGinity as he watched him waver a moment, to and fro, then, with a scream that sounded almost human, plunge to his death on the rocks below. If he was not instantly killed by the fall, he was drowned, for his body rolled off the rocks and was engulfed in the sea.
XXV
To this day, McGinity believes that when he fired that last shot, the bullet ricocheted off a stone and entered a vital spot in Mr. Zzyx's body; and that the creature was as good as dead when he plunged from the parapet. I never did believe that. For that matter, we had no means of knowing the truth, for the body was never recovered from its watery grave.
I doubt if Pat heard much of the stress and sound of battle. She insists that she did. She must have slipped off in a faint, and had had time to come out of it when McGinity burst the door open and released her. He found her crumpled up in the small closet space, like a pale flower broken in the storm. She gazed up at him dazedly, but with a faint smile.
By the time they got down to the island dock, the water seemed filled with private launches, wealthy residents living along the North Shore
having been attracted to the scene by the fire. A belated fire-boat began spouting water on the smoldering ruins of the shanty as they cast off in the runabout for the mainland.
As soon as McGinity had given me a quick summary of what had happened, and Pat had enjoyed a good cry in my embrace, I advised keeping everything quiet until we could report to the proper police authorities. When we reached the castle, we were surprised to find village policemen all over the place. It seems that Jane, on being told of the fire, had ordered Schweizer to summon the village fire department, but the butler was so excited that he dialed the wrong number, and got the police station. Furthermore, he never mentioned the fire. A touch of comedy which is never far away from tragedy. It was perhaps just as well, as everything had to come out eventually. To Chief of Police Meigs, of Sands Cliff village, I gave a clear account of the whole wretched affair, which caused even that big, grim-faced individual to shudder. McGinity was feeling pretty sick himself over the death of Mr. Zzyx. To hear him talk about it, and the way he carried on, you would think he was guilty of premeditated murder, and would have to answer to the law
Something of his mental unrest must have reached the Chief of Police, for, just as the Chief was leaving, he put his hand gently on the reporter's shoulder, and said: "Now, you quit your worrying, son. We'll fix this up, all right."
There were more bad minutes for us both when Pat and Jane found out about Niki. It was pretty terrible to hear them go on. But an hour after the police had arrived, Niki's body had been removed to the village mortuary, and all signs of blood stealthily and carefully removed by the servants, while the furnishings of the various rooms and halls, which had sustained damage during the rampage, were replaced as far as possible, and some semblance of the former formality of things restored.
Naturally, we were again overrun by city reporters, to whom, acting as spokesman, I gave only the absolutely necessary facts. Unwittingly, McGinity had now got himself mixed up in the news, and for the first time in his brief reportorial career, publicity was the last
thing on earth he wanted, or was at all interested in. I spared him as much as possible, for I quickly realized he was laboring under the delusion that to have his name linked to Pat's in his tragic encounter with Mr. Zzyx would cause her much embarrassment, if not unpleasantness. But I happened to know that Pat didn't mind in the least; in fact, that she was very proud of the association of their names, even in these most sordid and harrowing circumstances.
Henry returned from his long motor drive a little after five o'clock. I would have given a king's ransom to have avoided meeting him, and disclosing the drama of crime that had been enacted during his absence, involving the loss of two lives.
Fortunately, I was relieved of this very unpleasant duty. As it turned out, Chief of Police Meigs had met Henry on the road, recognized his car, and stopped him. So he had a rather fair idea of what had occurred. I could plainly see the news weighed on him heavily, betrayed by his white face, quivering hands, and the pathetic droop of his mouth.
When McGinity and I followed him into the library, he dropped into his desk-chair with a moan that stirred my deepest pity and sympathy. In his anguish of mind, he kept muttering: "Niki murdered ... in my house!" and glancing suspiciously at the reporter
"It wasn't necessary, I'm sure, for you to drive Mr. Zzyx to his death," he said finally, addressing McGinity
"No one regrets the occurrence more than I do, Mr. Royce, but it can't be helped now," McGinity said, in a low, apologetic tone.
"It seems such a senseless sort of murder," Henry said.
"But it wasn't murder," I promptly corrected him. "Pat's life was endangered, as well as McGinity's, and I think he would have been wise if he had shot Mr. Zzyx dead, on the spot, which, of course, he didn't. Mr. Zzyx's end, while horrible, was purely accidental."
"Oh, you think that, do you?" Henry turned on me savagely. "Well, it's a lie!" he quavered, as he came to his feet, shaking his fist at me. "It wasn't necessary for you, Livingston, to interfere in this matter at all, but it's the sort of thing you've done all your life—interfering in my
affairs. You've never considered me in the least—thoughtless— selfish!"
Then, as suddenly as he rose, he collapsed over the desk. We both thought he had fainted, but he waved away our offers of assistance.
"I'm all right," he mumbled, sinking back in his chair. "Sit down, Livingston. Sit down, McGinity. I'm rather upset. At my age ... being met in my house with this dreadful news! Now, McGinity," he concluded, in a quiet voice, "tell me all about it."
McGinity told the story briefly, and Henry listened without interruption, believing when the reporter had finished that the subject had been brought to a definite conclusion. Unfortunately, there was something else to be cleared up. Matters had come to a crisis, and it was high time we convinced Henry that he had been made a victim of a hoax. But how were we to prove and justify our suspicions?
I had infinite faith in the capability of the reporter in meeting the situation, and I was greatly pleased when he rose to the occasion, and laid before Henry all the suspicious circumstances which he knew to be material to the point, particularly referring to the spurious scroll, which I produced immediately for my brother's inspection.
Henry seemed staggered by the disclosure. "Science has been a curse to me," he quavered. "I wish to God I had never dabbled in it."
"It looks to me now, Mr. Royce," McGinity observed, "that in all this careful preparation of the plot, there was only one slip, and that was in using this parchment paper containing a familiar water-mark, which you have just seen. If the scroll is counterfeit, then that radio message from Mars, which told of its being secreted in the rocket, was not legitimate. You will also recall that no mention was made in this message of any occupant of the rocket. How do you explain the presence there of the late, lamented Mr. Zzyx? Was he just a coincidence?"
"I've been keeping my mouth shut on that point," Henry answered, "but I will be quite frank now, and admit that Mr. Zzyx was a coincidence. I'd particularly like to know how he got into the rocket. If he was a species of the man-ape inhabiting the tropical zone of
Mars, as described in the scroll, and depicted on the screen last night, and was captured and locked in the rocket, and sent earthwards in the interest of science—"
"Oh, come now, Mr. Royce!" McGinity interrupted, with a kindly smile. "If the scroll is not genuine, then its contents can only be false."
"Too true," Henry admitted, mournfully. "But it was so cleverly thought out—a masterpiece of invention. I'll go further, and say it was an inspiration. The most original and logical concept of life on Mars that has ever been given to the world. But the question that's agitating my poor brain now, is how did Mr. Zzyx get into the rocket?"
"There'll be no difficulty in finding that out, sir, although it may take a little time," McGinity said. "No more difficult than proving that the scroll was a fake. Truth will out, sir."
"But how are you going to find out the whole truth, young man?" Henry asked, his voice fairly wailing.
"I can only tell you this much," McGinity answered. "Things have started to break—first, the discovery of the water-mark in the scroll, and, secondly, the theft of the rocket from the Museum of Science— and they'll keep on breaking. That happens every day in newspaper reporting business. In all big newspaper, or police stories, like mystery murders, kidnappings, state and civic scandals the underlying motives, means and methods are so closely linked that to solve one automatically brings another to light. When things begin to break, it's like touching off a string of fire-crackers—one explosion sets off another."
Henry shook his head, and rose abruptly. He appeared to have reached the limit of endurance. "I'm going out for a little air," he announced. As he went slowly out of the room, he looked pathetically old and broken.
As soon as he had gone, the reporter turned to me. "Well, what do you say, Mr. Royce? Shall we continue to go through with this business?"
"Of course," I replied. "And the sooner the next break comes, the better it'll suit me."
"All right, Mr Royce," said the reporter, with a broad grin. "That suits me down to the ground. Now," he continued, glancing at his watch, and walking towards the radio, "let's tune in, shall we? It's just six o'clock."
A fraction of a second after he had tuned in, the stentorian voice of the announcer of the NRC radio press bureau broke the silence of the room. This is what he said:
"Late this afternoon, the police recovered the rocket from Mars, stolen last night from the New York Museum of Science. It was found on the bottom of the East River, at the foot of East Sixty-fourth Street. But nothing else so far has been uncovered by the police. Not the slightest clue to the identity of the thieves. Any person listening in, who may have information regarding this theft, and the subsequent disposal of the rocket in the river, will stand a good chance of winning a $5,000 reward by communicating at once with Police Headquarters in Manhattan, or at any police station in the greater city."
"Well, McGinity," I said, after the announcer had signed off, "that's break number three. You're a pretty good guesser. Now, perhaps, you can predict when the next break will come."
"Oh, I don't know," the reporter answered, half musingly. "I'm chuck full of funny ideas, you know." He thought a moment, then said: "Well, I've a good hunch that the next break will come by telephone, and that it'll bring some startling information."
He had hardly uttered the last word when the telephone on Henry's desk began to trill. I strode quickly to the instrument, and as I picked up the receiver, McGinity came to the side of the desk, making no attempt to hide his amusement.
"Good Lord!" he remarked, laughing. "I'd no idea that break number four would come so quickly."
I silenced him with a wave of my hand. The voice on the telephone was weak and trembling—a woman's voice.
"Is this the home of Henry Royce?" inquired the voice. "Can I speak to Mr. Henry Royce, or to his brother, Livingston?"
"This is Livingston Royce, speaking," I replied.
"Oh, Mr. Royce! For God's sake, come to me at once! This is—"
The voice broke off abruptly, in a low gurgling sound that conveyed a sense of its being strangled in the speaker's throat. Then, curiously enough, I heard the voice again, miles off, it seemed—a smothered, muffled cry of "Help! Help!" Then it trailed out into indistinctness, and there was complete silence on the telephone. The voice was familiar, but for the moment I could not place it.
Cradling the receiver, I sat staring up at the reporter. He spoke first— it seemed as if a long time had elapsed before he did speak.
"Who was it?" he asked. "Somebody that we want?"
"Yes; I think so," I replied, almost breathlessly. "Yes; I'm sure it is."
The voice on the telephone had set my memory working; stimulating my forgetful mind. I had a sort of vision. In fancy, I could see the outline of an old house, silhouetted against the night sky. But there was not a speck of light to be seen in any of the windows.
And then, suddenly, as my mind groped in the darkness, a light dawned on me.
XXVI
I quickly recovered from the amazement which had momentarily possessed me. I had no doubt, hearing the mysterious voice on the telephone, that at last I had hit on something of a clue to the mystery of the Martian hoax. The voice, faintly familiar, had stirred up my recollections, and had established at once in my mind a positive suspect. Why this individual had not entered into my suspicions before is just one of those things that can't be explained. There was every chance now that he was mixed up in this. If so, I was convinced we were reaching the climax of the case.
"Well," I said, finally, turning to McGinity, "I think the stage is being set for the last interesting act of this affair."
He smiled a little dubiously "Don't make me laugh, Mr Royce," he said.
Having made an important discovery, I thought McGinity ought to know, so I told him briefly what had been said on the telephone, and my suspicions. He was silent for a moment, then he said: "Why didn't you think of this person before?"
It was on the tip of my tongue to reply: "Too stupid;" but I refrained from showing up my asinine denseness. Instead, I said: "The first thing to think of now is to trace that phone call."
"That'll be dead easy if the speaker used one of those old-time manual phones," he said; "but if the call was made on a dial instrument, there's no way of tracing it. You're sunk!"
A few minutes' conversation with the information operator proved the reporter's contentions to be true; I was "sunk." But not entirely "McGinity!" I exclaimed, "I must go to this place at once, and you must go with me. I'll lay anything I'm on the right track. I have a feeling too that every minute may be of importance."
To my surprise, the reporter hesitated. "Are you sure you recognized the woman who phoned by her voice?" he asked. "You may be mistaken, and with break number five liable to come any minute now, we can't afford to go off on some wild goose chase."
"Dead certain," I affirmed. "I'll stake all I've got on it. However, if you're so sure of number five breaking, we can stop at the Sands Cliff Police Station on our way, and you can notify them where we can be found."
"Queer doings, and not very plausible," McGinity remarked, after agreeing to my plan. "Yet—you may be right."
Feeling certain that on this expedition we should meet with some probably perilous adventure, I took good care to put one of Henry's revolvers in my pocket. It was an old-fashioned weapon, heavy and cumbersome, and just to prove that it was in good working order, I
fired it off, up in the air, as we drove along the dark, unfrequented road bordering on our estate. McGinity, who was driving, gave vent to an exclamation of mingled surprise and amusement. Heretofore, he had been the one inclined to the impetuous, while I was always of a more cautious nature.
"That old horse-pistol has certainly got a bang to it," he remarked, laughing. "But we're not going to hunt elephants, you know."
"You never can tell," I countered. "I've an idea—instinct—McGinity," I went on, "that we've a night's work before us. And it's quite possible that we may encounter an elephant, or a lion, before we get through;" my mind slipping back to my thrilling encounter with the grizzly bear on the LaRauche estate. "Now, for the police station."
Fortunately, we found Chief of Police Meigs at his desk, and to him I poured out my suspicions.
"Oh! so you believe old Rene LaRauche to be implicated in this Martian fake?" he said.
"LaRauche was obsessed with a jealous hatred of my brother, Henry," I replied, "and his motive may have been revenge. He's heaven high above my brother in his knowledge and application of science, and mentally equipped to perpetrate a hoax like this. Besides, he's always had the reputation of being brutally cruel to his wife, and apparently he had some good reason for choking her off when she sought aid from the outside on the phone. She's always been very friendly and charming to Henry and myself."
"Sounds like the act of a crazy man," the Chief offered. "If my belief's correct, he'll probably show fight if you start any inquiry, and go nosing about his place."
"As a matter of protection, McGinity and I are both armed," I informed him, "as this is hardly a case for police investigation. The perpetration of this hoax, as I understand it, is quite within the law, and while not something to be called a crime, it is none the less dastardly."
"I have a hunch that before you get through with it, you'll have to call in the police," said the Chief. "I'm very much interested in the case. I
drove past LaRauche's place yesterday, and I noticed it was all locked up, like he had closed the house, and gone to the city for the winter. I believe he has one manservant."
"A snoopy, unreliable person, who answers to the name of Orkins," I said; "formerly in our employ as a butler."
"He's been pointed out to me," said the Chief, "but I never knew his name. He often comes to the village for groceries. I haven't noticed him around lately. Come to think of it, I haven't laid eyes on LaRauche for several months."
At that juncture, a motorcycle policeman, who had been standing by, evidently listening in, motioned his chief to step to one side. After a few minutes' conversation, Chief Meigs returned to us, and said:
"I've just been informed that LaRauche hasn't been seen around these parts for three months, at least. Looks like he's been in hiding. This motorcycle policeman also tells me that in passing the LaRauche house, on his daily route, two days ago, he saw a woman looking out of a top-story window, and waving. As there was no indication that she was in distress, or even signaling to him, he passed on. She was scantily clothed, he says; looked like she was wearing a nightgown. If that may be of any interest to you."
"I consider it very important information, Chief," said McGinity. "It confirms the intimation that Mr. Royce got on the phone, that Mrs. LaRauche is virtually a prisoner in her own home, and that her life is in danger. She was probably trying to attract the policeman's attention."
"If, in your inquiries, you find that to be the case," the Chief suggested, "all you've got to do is to get me word. If it's necessary, we'll get a search-warrant, and open the house and search it ourselves. I'll be at the station here for another hour, so you'll know where to find me, in case there's something I can do."
I thanked him for the suggestion, and in less than five minutes, McGinity and I were leaving the lights of the village behind, and were speeding over a winding, hilly road, along which I should have preferred to travel in daylight if I had been driving alone. As we
neared the LaRauche place, the country became wilder and more solitary. I often wondered what could have brought LaRauche to these lonely, frowning hills.
Suddenly, I signaled a stop, and we halted a short ways from the gateway, taking care to dim our headlights. As we walked cautiously up the footpath, which led from the road to the house, I told McGinity about my encounter with the grizzly bear.
By that time, we could make out the outline of the old house quite clearly against the starlit sky. But there was not a gleam of light; the whole house looked black. For a few minutes, in order to get the lay of the land, we crouched behind some bushes directly in front of the residence.
Blinds were drawn; some of the windows were shuttered. There was an atmosphere of silence about the place that was uncanny; no sound, not even the distant bark of a dog one usually hears in the country at night. Certainly no sign of human life. I glanced over my shoulder, to the right, in the direction of the old brick farm-house, in the hollow, where the Italian animal trainer lived, but I might just as well have been staring at a brick wall. No light—no sound—in that direction.
Presently, we crept upon the front porch. I tiptoed along the porch in the hope of getting a peep in at the lower windows, but the blinds were drawn, and I could see nothing of the interior I knew where to find the bell, and I rang it once, twice, thrice. It was an old-fashioned, jangling bell that echoed dismally in the silence of the night.
When there was no response, we retraced our steps as far as the friendly bushes, and continued to watch the house from that point until we were both equally certain that the place, after all, was unoccupied. We were about to turn away, feeling that we might as well return to the police station, when something happened. That something was the sudden lighting up of a window in the top-story.
Silhouetted against this light, we saw a figure, unmistakably that of a woman. A few seconds later, another figure appeared in the windowframe of light. What followed was like old-time shadowgraphs, which
used to delight me when I was a child: black, shadowy figures in action against a dimly lighted background. We saw an arm upraised and then fall, as though a blow had been delivered, and then two arms thrusting the woman-like figure away from the window, by force. Then the window went dark again.
There was nothing to do but turn away, and return to the car. On the way, I suggested to McGinity that we drive back about a mile, where I recalled seeing a light gleaming among a dense growth of pine trees. If it was a human habitation, I figured that the occupants, living so near the LaRauche estate, might give us some much desired information.
We found a light burning in a small cabin, in a clearing in the woods, set well back from the road. Our knock was answered by an elderly, gray-haired man, with a laborer's stoop in his shoulders. He inspected us a moment over his spectacles, then invited us to enter.
He turned out to be a carpenter and wood-chopper. His wife and daughter, he explained, had gone to the movies, in the village, with his wife's sister, who evidently was better placed in life and owned a car.
"Now, can I be of any service?" he asked, showing us to chairs in front of a blazing log-fire, in a plain but cheerful room, modern enough to have electric lights and a telephone.
I made a polite reply, without giving ourselves away. I was a friend of Dr. LaRauche, and had been surprised, on calling, to find his house dark. There had been no answer to the bell.
The carpenter smiled grimly, and said: "I'm afraid, stranger, you'll never git eny response to the ringin' of that bell, if you ring till Judgment Day. Others have tried, unsuccessfully, myself included. Old Doc LaRauche owes me considerable fer some wood-choppin' I done fer 'im."
"How do you explain it?" I asked.
"A lot of mysterious goin's on in that 'er house, of late," the carpenter answered, wagging his head, "which I, for one, can't answer fer. A very mysterious family!"
"From which I gather that Mrs. LaRauche is there, with her husband?" I said. "It's very urgent that I see her at once."
"No one 'ereabouts knows exactly what's happened to the poor lady," replied the carpenter. "It's common report that the old man keeps 'er locked up. Only yisterday, my wife went over with a paper bag of fruit, oranges and the like, which she intended leavin' fer the poor soul, but nary an answer to the bell."
"It's very lonely over there," I remarked. "No neighbors—"
"Ah, but they did have a close neighbor," the carpenter interrupted, "till the law stepped in and took 'im away. That old brick house, in the hollow. Maybe, now, you remember seein' it?"
"That's so—I'd forgotten," I said. "But tell me, what happened?"
"Last Spring, an Eytalian by the name of Antonio Ranzetti moved into the farm-house, vacant it was fer the last five years, and gone to ruin, like. He made a business of trainin' animals fer the circus, but he was cruel to 'em, awful cruel, so I 'eerd. So Doc LaRauche, wantin' to git rid of an undesirable neighbor, reported 'im to some society that protects animals—"
"Probably the Society for the Prevention of Cruelty to Animals," I interjected.
"Anyhow," the carpenter continued, "the Eytalian was arrested, tried, and sent to the hoose-gow fer ninety days."
"Oh, indeed!" I murmured.
"Yes; and he oughta be gittin' out, now, one of these fine days," said the carpenter. Then he added: "Now, is there anythin' else you'd like to know, stranger?"
I shook my head, as I realized at once that we were not likely to get any more valuable information than this. As we rose to leave, a bright idea struck McGinity. Why not get in touch with Chief of Police Meigs while we had a telephone handy?
I did what he suggested, and spent a few minutes talking to the Chief, while McGinity collared the carpenter and engaged him in
conversation until I had finished. Outside, I gripped the reporter by the arm, and exclaimed: "Things are still breaking. As sure as fate, LaRauche and Orkins are at the bottom of all this."
"What's happened?" asked McGinity.
"Chief Meigs says that five minutes after we'd left the station, a local garage owner called, and reported that he had rented a small, light truck to Orkins, night before last, who had explained that he was moving some of LaRauche's household belongings into the city. The description of the truck that carried off the rocket from the Museum of Science, in New York, as given over the air, and in the newspapers, he said, tallied with his own vehicle, which he found parked in front of his garage when he opened up this morning."
"Good!" the reporter exclaimed. "What else did he tell you?"
"This. He's getting a search warrant, and says he'll join us in about half an hour. We're to wait for him, at the side of the road, about a quarter of a mile beyond this cabin."
XXVII
The time of waiting came to an end, and as soon as Chief Meigs arrived in his car, armed with a search warrant and a short-handled axe, we drove straight on to the LaRauche estate, parking our cars about a hundred yards from the gate. As we strode along the high road, three abreast, the Chief imparted some more startling information, so particularly important that instinctively we quickened our steps.
"Listen," he began. "I had just hung up on you, Mr Royce, when the phone rang. I answered. It was a man's voice, with an English-like accent, and low and trembly, if you know what I mean."
"Orkins, without a doubt," I said. "But he's not English. That accent is only a cultivated one."
"Well, he wanted to consult with the Chief of Police," the officer went on, "about the $5,000 reward. When I informed him the Chief was speaking, he wanted to know if he came to the police station, and disclosed the name of the man who had stolen the rocket, would he stand a good chance in getting the reward. I told him I thought he would, and to come right along."
"Didn't he say who he was?" McGinity asked.
"No. And he was very particular that I promise not to reveal his identity after he had given me the necessary information. Finally, when I agreed to this, he said: 'I'll be with you inside an hour.'"
"Then what?" I inquired, agitatedly.
"Apparently we were cut off," the Chief replied; "and yet we weren't exactly disconnected, as I will explain. Something must have happened that caused him to drop the receiver, and get away from the phone in a hurry. I could hear two voices, now—muffled-like, and growing more distinct. Then came a sound like heavy and hurried footfalls would make on a bare floor, followed by two distinct crashes, like some furniture had been overturned. All of a sudden, there was a report, like the crack of a whip. It might have been a pistol shot, but that's only a guess."
"I think you've guessed right, Chief," I said. "It's my belief that LaRauche overheard Orkins, while he was phoning to you, and attacked him. There was a scuffle, and one of them got shot."
"Double-crossing the old man, no doubt," McGinity suggested.
"Just that," I approved. "Orkins is as double-faced and treacherous as he's avaricious."
"Looks like we're going to have an interesting night," the reporter remarked. "Things seem to be getting a bit hot."
"Yes; and they're going to get still hotter, if I know my business," the Chief muttered.
We entered the estate, and went along the path to the dark, lonely house where there was so much mystery; and where there's mystery, there's always danger. Blinds were still drawn, and windows
shuttered. After I had jangled the bell, several times, and there was no response, Chief Meigs began to hammer on the door. We waited outside for five minutes, ringing and hammering at intervals. Presently, the police officer took out his axe, and smashed a panel in the door, and thrust his arm through. I heard the snap of the lock as he pushed the door open.
I followed him into the entrance hall, and then I did something very foolish. I blew my police whistle. McGinity chuckled. "What are you scared about, Mr. Royce?" he asked. "Calling the police?"
"I'm scared," I admitted, in an embarrassed undertone. "I have a feeling that the man we're after—LaRauche—is not going to worry very much about your life or mine."
At that I turned, to give vent to an exclamation of horror. My flesh crept. The Chief's flashlight was trained on the stairs. The beam of light disclosed a body, spread-eagled halfway down the uncarpeted steps, head down, arms outflung, as though it had plunged backwards from the first landing which was rather spacious, and ornamented by an old grandfather's clock.
After a brief inspection, I identified the gruesome thing as Orkins, our former butler. "Is it not suicide?" I asked.
The Chief shook his head. "Looks like plain murder," he answered. "Shot through the back, by LaRauche, from the bottom of the stairs, probably, just as he reached the first landing, in a futile attempt to escape."
I stood looking down at the dead man. "So passes poor old Orkins," I thought. "Too bad he got the worst of it." But there was no time for sentimentalizing over the crafty, avaricious butler, who, apparently, had paid with his life for attempting to betray his employer.
Already Chief Meigs had found a switch, and he and McGinity were inspecting the library, where the dial telephone was, in the faint glow of an overhead light. The telephone receiver was dangling at the end of its cord; two chairs were overturned; all mute and unmistakable evidence of the grisly encounter the Chief had heard on the telephone, climaxed by the pistol shot.
Everything looked dingy and untidy; there was a musty smell about the room. After a quick search there, we passed through several other rooms on the ground floor, including the kitchen, where there were many greasy plates and plenty of unwashed china and cooking utensils. A door, under a back stairway in the kitchen, evidently led to the basement; it was fastened with a patent lock.
As none of the rooms on the ground floor, except the library and kitchen, bore evidence of recent occupation, Chief Meigs suggested that we make a quick search of the upper floors. "LaRauche, no doubt," he said, "is in hiding somewhere about the house, and I think we're going to have some trouble before we get him."
"That is, if he hasn't already escaped us," McGinity ventured.
"There's some doubt about that," the Chief answered. "All the doors and windows on this floor are locked, and fastened on the inside, and he couldn't possibly have snapped that patent lock on the door in the kitchen, from the inside, if he had wanted to hide in the basement."
"But Mrs. LaRauche!" I said. "Where is she? We've got to find her!"
In reply, the Chief signaled to McGinity and me, to follow him up the dark, back stairway to the second floor. Feeling along the wall in the hall, on this floor, I found a switch, and snapped on the lights. But they were very dim, of low candle-power, and in searching the bedrooms and closets, we had to again resort to the use of the flashlight. Two of the bedrooms seemed to have been recently tenanted, with beds unmade, and men's clothing and soiled linen lying about in great disorder. One of these, apparently Orkins' room, contained a small radio, over which he had undoubtedly heard the announcement of the $5,000 reward. The whole interior of the house showed the absence of a domesticated hand. At the end of the corridor, we looked into a large double room, which LaRauche had equipped as a laboratory.
Finally, we reached the narrow corridor in the top story, where we were faced by four doors. Three of them were unlocked. Pushing them open, we looked into two unfurnished rooms, and another used
for storage. The fourth door, at the end of the passageway, was locked. Repeated knocking brought no answer.
This was the last unexplored room in the house. The room particularly interested me because it was there that McGinity and I had witnessed the dramatic shadowgraph episode in the window. So far we had failed to trace LaRauche's movements in the house, or gain the slightest clue to his hiding-place. Was he hiding in this attic room? And where was Mrs. LaRauche?
Chief Meigs was a man of infinite resources. He had either anticipated this, or had become expert in unlocking doors. He produced a heavy bunch of keys, from which he selected three. His first two attempts failed to open the door. The third time, proverbially the charm, the key turned in the lock, and the door swung open.
I would have been the first to step through, but the Chief stopped me. "Stay where you are," he whispered; "it's a little dangerous."
Standing in the doorway, the Chief trained the beam of his electric torch on various objects in the room. Finally it rested on an arm-chair beside an iron bedstead. Something was in that chair, and it was covered with a sheet. He strode over, and pulled back the sheet, and then we began to understand the secret which the old house held.
I gasped and stared. Huddled in the chair was Mrs. LaRauche, deadly pale and hollow cheeked, and apparently unconscious, her emaciated form showing under the folds of a quilted silk dressinggown which had once been lavender in hue. Adhesive tape had been placed over her mouth, and her arms were bound to the siderests of the chair by picture wire.
"Thank God, she's alive!" Chief Meigs murmured, as he stooped over her. "Looks like nothing very much wrong with her, except that she's had a pretty bad shock."
As he finished speaking, the woman's head moved; her eyelids fluttered, and then she opened her eyes. We saw at once that she was in a panic of fear. I could hardly realize that this pitiful, ghostly shadow was the same woman I had met several months ago.