Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 5FF46B5DBC1 for ; Fri, 1 Jul 2011 07:13:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 84151-02 for ; Fri, 1 Jul 2011 10:13:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from outrelay01.libero.it (outrelay01.libero.it [212.52.84.101]) by mail.postgresql.org (Postfix) with ESMTP id EDD83B5DBCA for ; Fri, 1 Jul 2011 07:13:33 -0300 (ADT) X-CTCH-Spam: Unknown X-CTCH-RefID: str=0001.0A0B020B.4E0D9DCD.004C,ss=1,re=0.000,fgs=0 X-libjamoibt: 1821 Received: from wmail49 (172.31.0.239) by outrelay01.libero.it (8.5.133) (authenticated as francescoboccacci@libero.it) id 4DE4FF2502330F69 for pgsql-admin@postgresql.org; Fri, 1 Jul 2011 12:13:33 +0200 Message-ID: <8011192.5657131309515213054.JavaMail.defaultUser@defaultHost> Date: Fri, 1 Jul 2011 12:13:33 +0200 (CEST) From: "francescoboccacci@libero.it" Reply-To: "francescoboccacci@libero.it" To: pgsql-admin@postgresql.org Subject: Import image into postgresql database MIME-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-SenderIP: 213.182.95.210 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=BAYES_40=-0.001, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201107/4 X-Sequence-Number: 37783 Dear all, i have a question for you: I would like to store images (jpg) into a table of postgresql database. My question is : what is the corret type of tables filed that i have to use? Reading some forum of article in the net there are two ways: bytea or oid type. Whati is the best type to store my images? I tried to insert in both ways. With oid type i able to insert images, but with bytea i don't understand how store it . i create a test table: CREATE TABLE public.images ( imgname text, img bytea ) and i tried many ways: NSERT INTO images (imgname, img) VALUES ('beautiful image', bytea_import('C:\\9999.jpg')); or INSERT INTO images (img) VALUES (pg_escape_bytea('C:\\9999.jpg')) but it doesn't work. So How can i solve my problem? and another question.. If i able to store my image into bytea fiels..how can i export it for see it for example with paint? Thanks Francesco Boccacci