Thread: Large Object => invalid input syntax for integer: ""
I need to use large objects BUT I am having problemns... I instaled PostgreSQL 8.0.3 windows version with lo module. first, I created the table below: CREATE TABLE test ( description varchar(20), picture lo ) WITHOUT OIDS; After trying to make one insert without value for the lo I get the error below: INSERT INTO test VALUES (1); ERROR: invalid input syntax for integer: "" Which value I can put on the default of the lo to solve this ? I alreday tryed -1, 0, 1, null but nothing works... Why this problem? Regards, Rodrigo Carvalhaes -- Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo.
On 6/6/05 4:58 am, "grupos" <grupos@carvalhaes.net> wrote: > I need to use large objects BUT I am having problemns... I instaled > PostgreSQL 8.0.3 windows version with lo module. > > first, I created the table below: > CREATE TABLE test > ( > description varchar(20), > picture lo > ) > WITHOUT OIDS; > > After trying to make one insert without value for the lo I get the error > below: > > INSERT INTO test VALUES (1); > > ERROR: invalid input syntax for integer: "" > > Which value I can put on the default of the lo to solve this ? I alreday > tryed -1, 0, 1, null but nothing works... > > Why this problem? I think the problem is nothing to do with lo, you are trying to insert an integer into a varchar field, try INSERT INTO test VALUES ('1'); HTH adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
grupos <grupos@carvalhaes.net> writes: > I need to use large objects BUT I am having problemns... I instaled > PostgreSQL 8.0.3 windows version with lo module. > > first, I created the table below: > CREATE TABLE test > ( > description varchar(20), > picture lo > ) > WITHOUT OIDS; > > After trying to make one insert without value for the lo I get the > error below: > > INSERT INTO test VALUES (1); > > ERROR: invalid input syntax for integer: "" This means you're trying to insert an integer value into the "description" column, which is text. It has nothing to do with large objects. To insert an LO into a database, you do the following: BEGIN a transaction Call lo_create() to make a new large object. The return value is the OID of the LO, which you will need later. Call lo_write() and lo_close() to put data into the LO Insert the OID you got from lo_create() in the referencing column ("picture", in your case) COMMIT the transaction It's a little annoying but that's how it works. -Doug
Hi Adam, I am sorry for the misunderstanding, when I compose the e-mail I forgot the ' ' on the 1 BUT the error is the same, I made: INSERT INTO test VALUES ('1') and I get the error: ERROR: invalid input syntax for integer: "" I am sure that there is some problem with LO. Regards, Rodrigo Carvalhaes Adam Witney wrote: >On 6/6/05 4:58 am, "grupos" <grupos@carvalhaes.net> wrote: > > > >>I need to use large objects BUT I am having problemns... I instaled >>PostgreSQL 8.0.3 windows version with lo module. >> >>first, I created the table below: >>CREATE TABLE test >>( >>description varchar(20), >>picture lo >>) >>WITHOUT OIDS; >> >>After trying to make one insert without value for the lo I get the error >>below: >> >>INSERT INTO test VALUES (1); >> >>ERROR: invalid input syntax for integer: "" >> >>Which value I can put on the default of the lo to solve this ? I alreday >>tryed -1, 0, 1, null but nothing works... >> >>Why this problem? >> >> > >I think the problem is nothing to do with lo, you are trying to insert an >integer into a varchar field, try > >INSERT INTO test VALUES ('1'); > >HTH > >adam > > > > -- Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo.
Hi Doug! Thanks for your e-mail BUT the point is how I insert data on a table when the column lo have no value ( NULL), to insert the lo I have no problem BUT the problem is when the column should have no value... Regards, Rodrigo Carvalhaes Douglas McNaught wrote: >grupos <grupos@carvalhaes.net> writes: > > > >>I need to use large objects BUT I am having problemns... I instaled >>PostgreSQL 8.0.3 windows version with lo module. >> >>first, I created the table below: >>CREATE TABLE test >>( >> description varchar(20), >> picture lo >>) >>WITHOUT OIDS; >> >>After trying to make one insert without value for the lo I get the >>error below: >> >>INSERT INTO test VALUES (1); >> >>ERROR: invalid input syntax for integer: "" >> >> > >This means you're trying to insert an integer value into the >"description" column, which is text. It has nothing to do with large >objects. > >To insert an LO into a database, you do the following: > >BEGIN a transaction >Call lo_create() to make a new large object. The return value is the > OID of the LO, which you will need later. >Call lo_write() and lo_close() to put data into the LO >Insert the OID you got from lo_create() in the referencing column > ("picture", in your case) >COMMIT the transaction > >It's a little annoying but that's how it works. > >-Doug > > > -- Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo.
grupos <grupos@carvalhaes.net> writes: > Hi Adam, > > I am sorry for the misunderstanding, when I compose the e-mail I > forgot the ' ' on the 1 BUT the error is the same, I made: > INSERT INTO test VALUES ('1') > > and I get the error: > ERROR: invalid input syntax for integer: "" > > I am sure that there is some problem with LO. Try inserting an explicit NULL: INSERT INTO test VALUES ('1', NULL); -Doug
grupos <grupos@carvalhaes.net> writes: > Hi Doug! > > Thanks for your e-mail BUT the point is how I insert data on a table > when the column lo have no value ( NULL), to insert the lo I have no > problem BUT the problem is when the column should have no value... If the "lo" field isn't NOT NULL than you should have no problem. The error message in your previous email came from trying to insert an integer into a text column. If you are still having problems please post your table definitions and the exact query that is causing trouble. -Doug
Hi Douglas, Thanks for your promptly answer. Here is the "step by step": CREATE TABLE test ( description varchar(20), picture lo ) WITHOUT OIDS; INSERT INTO test (description) VALUES ('1'); And then, the error : INSERT INTO test (description) VALUES ('1') What I am trying to do is insert data only on the column description, leaving the column picture null (because for this tuple there is no image). Regards, Rodrigo Carvalhaes Douglas McNaught wrote: >grupos <grupos@carvalhaes.net> writes: > > > >>I need to use large objects BUT I am having problemns... I instaled >>PostgreSQL 8.0.3 windows version with lo module. >> >>first, I created the table below: >>CREATE TABLE test >>( >> description varchar(20), >> picture lo >>) >>WITHOUT OIDS; >> >>After trying to make one insert without value for the lo I get the >>error below: >> >>INSERT INTO test VALUES (1); >> >>ERROR: invalid input syntax for integer: "" >> >> > >This means you're trying to insert an integer value into the >"description" column, which is text. It has nothing to do with large >objects. > >To insert an LO into a database, you do the following: > >BEGIN a transaction >Call lo_create() to make a new large object. The return value is the > OID of the LO, which you will need later. >Call lo_write() and lo_close() to put data into the LO >Insert the OID you got from lo_create() in the referencing column > ("picture", in your case) >COMMIT the transaction > >It's a little annoying but that's how it works. > >-Doug > >---------------------------(end of broadcast)--------------------------- >TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > -- Esta mensagem foi verificada pelo sistema de antivírus e acredita-se estar livre de perigo.
do you really need to use lo module ? try this ... CREATE TABLE test ( description varchar(20), picture oid ) WITHOUT OIDS; if you want to import a BLOB : insert into test values ("toto", lo_import('mypicture')) and if you want no value insert into test values ("toto", 0) -----Message d'origine----- De : pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org]De la part de grupos Envoy� : lundi 6 juin 2005 15:28 � : Douglas McNaught Cc : pgsql-general@postgresql.org Objet : Re: [GENERAL] Large Object => invalid input syntax for integer: "" Hi Doug! Thanks for your e-mail BUT the point is how I insert data on a table when the column lo have no value ( NULL), to insert the lo I have no problem BUT the problem is when the column should have no value... Regards, Rodrigo Carvalhaes Douglas McNaught wrote: >grupos <grupos@carvalhaes.net> writes: > > > >>I need to use large objects BUT I am having problemns... I instaled >>PostgreSQL 8.0.3 windows version with lo module. >> >>first, I created the table below: >>CREATE TABLE test >>( >> description varchar(20), >> picture lo >>) >>WITHOUT OIDS; >> >>After trying to make one insert without value for the lo I get the >>error below: >> >>INSERT INTO test VALUES (1); >> >>ERROR: invalid input syntax for integer: "" >> >> > >This means you're trying to insert an integer value into the >"description" column, which is text. It has nothing to do with large >objects. > >To insert an LO into a database, you do the following: > >BEGIN a transaction >Call lo_create() to make a new large object. The return value is the > OID of the LO, which you will need later. >Call lo_write() and lo_close() to put data into the LO >Insert the OID you got from lo_create() in the referencing column > ("picture", in your case) >COMMIT the transaction > >It's a little annoying but that's how it works. > >-Doug > > > -- Esta mensagem foi verificada pelo sistema de antiv�rus e acredita-se estar livre de perigo. ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend This mail has originated outside your organization, either from an external partner or the Global Internet. Keep this in mind if you answer this message. This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises.
grupos <grupos@carvalhaes.net> writes: > I need to use large objects BUT I am having problemns... I instaled > PostgreSQL 8.0.3 windows version with lo module. > first, I created the table below: > CREATE TABLE test > ( > description varchar(20), > picture lo > ) > WITHOUT OIDS; > After trying to make one insert without value for the lo I get the error > below: > INSERT INTO test VALUES (1); > ERROR: invalid input syntax for integer: "" This example works fine for me. What's more, that error message doesn't seem to have anything to do with LO columns --- it implies you were trying to insert into an integer column. (The error message could not be triggered by insertion into a varchar column either, contrary to some claims made elsewhere in this thread...) Are you sure that you are inserting into the table you think you are? I'm wondering about multiple tables named "test" in different schemas, for instance ... regards, tom lane
grupos wrote: > Hi Adam, > > I am sorry for the misunderstanding, when I compose the e-mail I forgot > the ' ' on the 1 BUT the error is the same, I made: > INSERT INTO test VALUES ('1') > > and I get the error: > ERROR: invalid input syntax for integer: "" > > I am sure that there is some problem with LO. Hmm - works here (Linux, 7.4.7) CREATE TABLE lotest4 (description varchar, picture lo) WITHOUT OIDS; INSERT INTO lotest4 (description) VALUES ('1'); SELECT * FROM lotest4; description | picture -------------+--------- 1 | Are you sure table "test" looks like that? -- Richard Huxton Archonet Ltd
----- Original Message ----- From: "Adam Witney" <awitney@sgul.ac.uk> To: "grupos" <grupos@carvalhaes.net>; "pgsql-general" <pgsql-general@postgresql.org> Sent: Monday, June 06, 2005 8:17 AM Subject: Re: [GENERAL] Large Object => invalid input syntax for integer: "" > On 6/6/05 4:58 am, "grupos" <grupos@carvalhaes.net> wrote: > >> I need to use large objects BUT I am having problemns... I instaled >> PostgreSQL 8.0.3 windows version with lo module. >> >> first, I created the table below: >> CREATE TABLE test >> ( >> description varchar(20), >> picture lo >> ) >> WITHOUT OIDS; >> >> After trying to make one insert without value for the lo I get the error >> below: >> >> INSERT INTO test VALUES (1); >> >> ERROR: invalid input syntax for integer: "" >> >> Which value I can put on the default of the lo to solve this ? I alreday >> tryed -1, 0, 1, null but nothing works... >> >> Why this problem? > > I think the problem is nothing to do with lo, you are trying to insert an > integer into a varchar field, try > > INSERT INTO test VALUES ('1'); > And do you need: INSERT INTO test (description) VALUES ('1'); Sean