Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit154146d

Browse files
committed
Rename lo_create(oid, bytea) to lo_from_bytea().
The previous naming broke the query that libpq's lo_initialize() usesto collect the OIDs of the server-side functions it requires, becausethat query effectively assumes that there is only one function namedlo_create in the pg_catalog schema (and likewise only one lo_open, etc).While we should certainly make libpq more robust about this, the naivequery will remain in use in the field for the foreseeable future, so itseems the only workable choice is to use a different name for the newfunction. lo_from_bytea() won a small straw poll.Back-patch into 9.4 where the new function was introduced.
1 parent7937910 commit154146d

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

‎doc/src/sgml/lobj.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,16 +547,16 @@ int lo_unlink(PGconn *conn, Oid lobjId);
547547
<row>
548548
<entry>
549549
<indexterm>
550-
<primary>lo_create</primary>
550+
<primary>lo_from_bytea</primary>
551551
</indexterm>
552-
<literal><function>lo_create(<parameter>loid</parameter> <type>oid</type>, <parameter>string</parameter> <type>bytea</type>)</function></literal>
552+
<literal><function>lo_from_bytea(<parameter>loid</parameter> <type>oid</type>, <parameter>string</parameter> <type>bytea</type>)</function></literal>
553553
</entry>
554554
<entry><type>oid</type></entry>
555555
<entry>
556556
Create a large object and store data there, returning its OID.
557557
Pass <literal>0</> to have the system choose an OID.
558558
</entry>
559-
<entry><literal>lo_create(0, E'\\xffffff00')</literal></entry>
559+
<entry><literal>lo_from_bytea(0, E'\\xffffff00')</literal></entry>
560560
<entry><literal>24528</literal></entry>
561561
</row>
562562

‎src/backend/libpq/be-fsstubs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,10 +862,10 @@ lo_get_fragment(PG_FUNCTION_ARGS)
862862
}
863863

864864
/*
865-
* Create LO with initial contents
865+
* Create LO with initial contents given by a bytea argument
866866
*/
867867
Datum
868-
lo_create_bytea(PG_FUNCTION_ARGS)
868+
lo_from_bytea(PG_FUNCTION_ARGS)
869869
{
870870
OidloOid=PG_GETARG_OID(0);
871871
bytea*str=PG_GETARG_BYTEA_PP(1);

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201406051
56+
#defineCATALOG_VERSION_NO201406121
5757

5858
#endif

‎src/include/catalog/pg_proc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,8 @@ DESCR("truncate large object");
10611061
DATA(insertOID=3172 (lo_truncate64PGNSPPGUID121000fffftfv2023"23 20"_null__null__null__null_lo_truncate64_null__null__null_ ));
10621062
DESCR("truncate large object (64 bit)");
10631063

1064-
DATA(insertOID=3457 (lo_createPGNSPPGUID121000fffftfv2026"26 17"_null__null__null__null_lo_create_bytea_null__null__null_ ));
1065-
DESCR("create new large object with content");
1064+
DATA(insertOID=3457 (lo_from_byteaPGNSPPGUID121000fffftfv2026"26 17"_null__null__null__null_lo_from_bytea_null__null__null_ ));
1065+
DESCR("create new large object withgivencontent");
10661066
DATA(insertOID=3458 (lo_getPGNSPPGUID121000fffftfv1017"26"_null__null__null__null_lo_get_null__null__null_ ));
10671067
DESCR("read entire large object");
10681068
DATA(insertOID=3459 (lo_getPGNSPPGUID121000fffftfv3017"26 20 23"_null__null__null__null_lo_get_fragment_null__null__null_ ));

‎src/include/libpq/be-fsstubs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern Datum lo_export(PG_FUNCTION_ARGS);
2525

2626
externDatumlo_creat(PG_FUNCTION_ARGS);
2727
externDatumlo_create(PG_FUNCTION_ARGS);
28-
externDatumlo_create_bytea(PG_FUNCTION_ARGS);
28+
externDatumlo_from_bytea(PG_FUNCTION_ARGS);
2929

3030
externDatumlo_open(PG_FUNCTION_ARGS);
3131
externDatumlo_close(PG_FUNCTION_ARGS);

‎src/test/regress/input/largeobject.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ SELECT lo_unlink(loid) FROM lotest_stash_values;
207207

208208
\set newloid_1 :LASTOID
209209

210-
SELECTlo_create(0, lo_get(:newloid_1)) AS newloid_2
210+
SELECTlo_from_bytea(0, lo_get(:newloid_1)) AS newloid_2
211211
\gset
212212

213213
SELECT md5(lo_get(:newloid_1)) = md5(lo_get(:newloid_2));

‎src/test/regress/output/largeobject.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ SELECT lo_unlink(loid) FROM lotest_stash_values;
393393
\lo_unlink :newloid
394394
\lo_import 'results/lotest.txt'
395395
\set newloid_1 :LASTOID
396-
SELECTlo_create(0, lo_get(:newloid_1)) AS newloid_2
396+
SELECTlo_from_bytea(0, lo_get(:newloid_1)) AS newloid_2
397397
\gset
398398
SELECT md5(lo_get(:newloid_1)) = md5(lo_get(:newloid_2));
399399
?column?

‎src/test/regress/output/largeobject_1.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ SELECT lo_unlink(loid) FROM lotest_stash_values;
393393
\lo_unlink :newloid
394394
\lo_import 'results/lotest.txt'
395395
\set newloid_1 :LASTOID
396-
SELECTlo_create(0, lo_get(:newloid_1)) AS newloid_2
396+
SELECTlo_from_bytea(0, lo_get(:newloid_1)) AS newloid_2
397397
\gset
398398
SELECT md5(lo_get(:newloid_1)) = md5(lo_get(:newloid_2));
399399
?column?

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp