aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/load.sgml
blob: 8fb5fafdb89ad50b45168d4dfdd299648485d3e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.7 1999/07/22 15:09:12 thomas Exp $
Postgres documentation
-->

<refentry id="SQL-LOAD">
 <refmeta>
  <refentrytitle id="SQL-LOAD-TITLE">
   LOAD
  </refentrytitle>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   LOAD
  </refname>
  <refpurpose>
   Dynamically loads an object file
  </refpurpose>
 </refnamediv>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>1999-07-20</date>
  </refsynopsisdivinfo>
  <synopsis>
LOAD '<replaceable class="PARAMETER">filename</replaceable>'
  </synopsis>

  <refsect2 id="R2-SQL-LOAD-1">
   <refsect2info>
    <date>1998-09-01</date>
   </refsect2info>
   <title>
    Inputs
   </title>
   <para>
    <variablelist>
     <varlistentry>
      <term><replaceable class="PARAMETER">filename</replaceable></term>
      <listitem>
       <para>
	Object file for dynamic loading.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>

  <refsect2 id="R2-SQL-LOAD-2">
   <refsect2info>
    <date>1998-09-24</date>
   </refsect2info>
   <title>
    Outputs
   </title>
   <para>

    <variablelist>
     <varlistentry>
      <term><computeroutput>
LOAD
       </computeroutput></term>
      <listitem>
       <para>
	Message returned on successful completion.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term><computeroutput>
ERROR:  LOAD: could not open file '<replaceable class="PARAMETER">filename</replaceable>'
       </computeroutput></term>
      <listitem>
       <para>
	Message returned if the specified file is not found. The file must be visible
	<emphasis>to the <productname>Postgres</productname> backend</emphasis>,
	with the appropriate full path name specified, to avoid this message.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>
 </refsynopsisdiv>

 <refsect1 id="R1-SQL-LOAD-1">
  <refsect1info>
   <date>1998-09-24</date>
  </refsect1info>
  <title>
   Description
  </title>

  <para>
   Loads an object (or ".o") file into the 
   <productname>Postgres</productname> backend address space.  Once a
   file is loaded, all functions in that file can be accessed.  This
   function is used in support of user-defined types and functions.
  </para>

  <para>
   If a file is not loaded using
   <command>LOAD</command>, 
   the file will be loaded automatically the first time the
   function is called by <productname>Postgres</productname>.
   <command>LOAD</command>
   can also be used to reload an object file if it has been edited and
   recompiled.  Only objects created from C language files are supported
   at this time.
  </para>

  <refsect2 id="R2-SQL-LOAD-3">
   <refsect2info>
    <date>1998-09-24</date>
   </refsect2info>
   <title>
    Notes
   </title>

   <para>
    Functions in loaded object files should not call functions in other
    object files loaded through the
    <command>LOAD</command>
    command. For example, all functions in file <literal>A</literal> should
    call each other, functions in the standard or math libraries, or in
    Postgres itself.  They should not call functions defined in a different
    loaded file <literal>B</literal>.
    This is because if <literal>B</literal> is reloaded, the Postgres loader is
    not able to relocate the calls from the functions in
    <literal>A</literal> into
    the new address space of <literal>B</literal>.
    If <literal>B</literal> is not reloaded, however, there will
    not be a problem.
   </para>
   <para>
    Object files must be compiled to contain position independent code.
    For example, 
    on DECstations you must use
    <application>/bin/cc</application>
    with the <literal>-G 0</literal> option when compiling object files to be
    loaded.
   </para>
   <para>
    Note that if you are porting <productname>Postgres</productname>
    to a new platform, <command>LOAD</command>
    will have to work in order to support ADTs.
   </para>
  </refsect2>
 </refsect1>

 <refsect1 id="R1-SQL-LOAD-2">
  <title>
   Usage
  </title>
  <para>
   Load the file <filename>/usr/postgres/demo/circle.o</filename>:

   <programlisting>
LOAD '/usr/postgres/demo/circle.o'
   </programlisting>
  </para>
 </refsect1>

 <refsect1 id="R1-SQL-LOAD-3">
  <title>
   Compatibility
  </title>

  <refsect2 id="R2-SQL-LOAD-4">
   <refsect2info>
    <date>1998-09-24</date>
   </refsect2info>
   <title>
    SQL92
   </title>
   <para>
    There is no <command>LOAD</command> in <acronym>SQL92</acronym>.
   </para>
  </refsect2>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->