diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-10-24 01:38:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-10-24 01:38:44 +0000 |
commit | 4f44aa04b53f26d3abbf64beb0c1b3d10be324a3 (patch) | |
tree | f32ad3b8c4819e87ac1fdcbe296b60880da55b56 /src/bin/psql/large_obj.c | |
parent | d7186cfa9b0807deb5c4f31975a4269efa0905cf (diff) |
Major overhaul of large-object implementation, by Denis Perchine with
kibitzing from Tom Lane. Large objects are now all stored in a single
system relation "pg_largeobject" --- no more xinv or xinx files, no more
relkind 'l'. This should offer substantial performance improvement for
large numbers of LOs, since there won't be directory bloat anymore.
It'll also fix problems like running out of locktable space when you
access thousands of LOs in one transaction.
Also clean up cruft in read/write routines. LOs with "holes" in them
(never-written byte ranges) now work just like Unix files with holes do:
a hole reads as zeroes but doesn't occupy storage space.
INITDB forced!
Diffstat (limited to 'src/bin/psql/large_obj.c')
-rw-r--r-- | src/bin/psql/large_obj.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c index 020b0173eb4..5cfd18c328f 100644 --- a/src/bin/psql/large_obj.c +++ b/src/bin/psql/large_obj.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.10 2000/04/12 17:16:22 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.11 2000/10/24 01:38:39 tgl Exp $ */ #include "postgres.h" #include "large_obj.h" @@ -193,7 +193,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg) /* insert description if given */ if (comment_arg) { - sprintf(buf, "INSERT INTO pg_description VALUES (%d, '", loid); + sprintf(buf, "INSERT INTO pg_description VALUES (%u, '", loid); for (i = 0; i < strlen(comment_arg); i++) if (comment_arg[i] == '\'') strcat(buf, "\\'"); @@ -284,7 +284,7 @@ do_lo_unlink(const char *loid_arg) } /* remove the comment as well */ - sprintf(buf, "DELETE FROM pg_description WHERE objoid = %d", loid); + sprintf(buf, "DELETE FROM pg_description WHERE objoid = %u", loid); if (!(res = PSQLexec(buf))) { if (own_transaction) @@ -328,15 +328,9 @@ do_lo_list(void) printQueryOpt myopt = pset.popt; strcpy(buf, - "SELECT usename as \"Owner\", substring(relname from 5) as \"ID\",\n" - " obj_description(pg_class.oid) as \"Description\"\n" - "FROM pg_class, pg_user\n" - "WHERE usesysid = relowner AND relkind = 'l'\n" - "UNION\n" - "SELECT NULL as \"Owner\", substring(relname from 5) as \"ID\",\n" - " obj_description(pg_class.oid) as \"Description\"\n" - "FROM pg_class\n" - "WHERE not exists (select 1 from pg_user where usesysid = relowner) AND relkind = 'l'\n" + "SELECT DISTINCT loid as \"ID\",\n" + " obj_description(loid) as \"Description\"\n" + "FROM pg_largeobject\n" "ORDER BY \"ID\""); res = PSQLexec(buf); |