X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81369535CF for ; Wed, 13 Apr 2005 14:41:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15488-07 for ; Wed, 13 Apr 2005 17:41:07 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id AC0315353E for ; Wed, 13 Apr 2005 14:41:07 -0300 (ADT) Received: from [192.168.1.102] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j3DHaOma021451; Wed, 13 Apr 2005 10:36:24 -0700 Message-ID: <425D59B3.4000207@commandprompt.com> Date: Wed, 13 Apr 2005 10:41:07 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris Hoover Cc: PostgreSQL Admin Subject: Re: Best way to store files inside db References: <425D5180.6020109@sermonaudio.com> In-Reply-To: <425D5180.6020109@sermonaudio.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/178 X-Sequence-Number: 17191 Chris Hoover wrote: > I am looking for some help/advice. We need to store some files inside > postgres (at least it has been requested of us). What is the best way > to do this? Right now, the files are all human readable text files, but > that could change. It depends on the size of the files. If the files are all reasonably small then bytea is a fine solution. However if you are going to be storing 5 meg PDF or some such thing I would suggest Large Objects. > How can I do this? I am thinking to store unmodified, I'll have to use > a bytea field. However, how do I tell the database to insert a file > (say "c:\test.txt") into the table? http://www.postgresql.org/docs/8.0/interactive/largeobjects.html ALl the language APIs have similar functions. Sincerely, Joshua D. Drake -- Your PostgreSQL solutions provider, Command Prompt, Inc. 24x7 support - 1.800.492.2240, programming, and consulting Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit http://www.commandprompt.com / http://www.postgresql.org