Re: [SQL] Image Insert Postgresql DB

2004-11-22 Thread Kenneth Gonsalves
On Tuesday 23 November 2004 12:48 pm, Premsun Choltanwanich wrote: > I face this same problem when I try to insert image by lo_import to > database with my client files. I already change the way to bytea data > type but it's not work. The error return like type mismatch when I try > to insert it fr

Re: [SQL] Image Insert Postgresql DB

2004-11-22 Thread Premsun Choltanwanich
I face this same problem when I try to insert image by lo_import to database with my client files. I already change the way to bytea data type but it's not work. The error return like type mismatch when I try to insert it from Binary variable. Why I cannot insert it? If anybody found some solution

[SQL] Image Insert Doubt

2004-11-22 Thread sreejith s
Dear Vishal, I have posted a doubt regarding image insert into Postgres. Thanx for ur valuable information. I am new to Postgres/Linux Environment. Intially i thought it would be better to store image path into DB. Later i changed my idea. Since it will be difficult/Tedious to bac

Re: [SQL] Image Insert Postgresql DB

2004-11-22 Thread Kenneth Gonsalves
On Tuesday 23 November 2004 09:51 am, sreejith s wrote: > Query to insert >  > INSERT INTO Imagetable VALUES (lo_import('C:\\image\\peach.jpg')); have you succeeded in inserting an image into the database from a file on the server using the above query? AFAIK you need a bytea

Re: [SQL] Image Insert Postgresql DB

2004-11-22 Thread Vishal Kashyap @ [SaiHertz]
Dear Shreejith , > Data type for Image > field in the DB is OID. > copy of Image file actually resides in the client. V have to insert > this image into the DB. Firtsly crosscheck the data type is OID it must be either bytea or blob. > > Query to insert > > INSERT INTO Imaget

[SQL] Image Insert Postgresql DB

2004-11-22 Thread sreejith s
Hello I have a doubt regarding Image insert into Postgres DB. Yesterday i posted a query regarding this. and this one is in continuation. I am working on Project with Linux Server and Windows Client environment. And v r developing windows based application. V have to scan images from scanner attche

Re: [SQL] Recursive SETOF function

2004-11-22 Thread Pierre-Frédéric Caillaud
SELECT INTO cid count(*) FROM providers WHERE uid =child_provider; Hey, hey. Better : SELECT blablah FROM providers WHERE uid = child_provider LIMIT 1; IF NOT FOUND THEN exit with error ELSE do your stuff Why scan more than 1 row when you just need existence

Re: [postgres] Re: [SQL] Recursive SETOF function

2004-11-22 Thread Richard Rowell
I had to fiddle a bit more, but I did finally get it to work. Thanks Mike CREATE OR REPLACE FUNCTION svp_getparentproviderids (INTEGER) RETURNS SETOF INTEGER AS ' DECLARE child_provider ALIAS FOR $1; cid INTEGER; BEGIN SELECT INTO cid count(*) FROM providers WHERE uid =child_provider;

Re: [postgres] Re: [SQL] Recursive SETOF function

2004-11-22 Thread Mike Rylander
Sorry about that... try this: CREATE OR REPLACE FUNCTION svp_getparentproviderids (INTEGER) RETURNS SETOF svp_getparentproviderids_uid_type AS ' DECLARE child_provider ALIAS FOR $1; cid svp_getparentproviderids_uid_type%ROWTYPE; tmp_cid INTEGER; BEGIN SELECT INTO tmp_cid count(*) FROM pr

Re: [SQL] Recursive SETOF function

2004-11-22 Thread Richard Rowell
I have been fiddling with what you sent. I have it working mostly, save for I keep getting syntax errors on the "RETURN NEXT cid;" line. If I remove this line then the function works ( but returns nothing of course). Any ideas on why the RETURN NEXT doesn't like the variable as a parameter? sp_

Re: [SQL] Recursive SETOF function

2004-11-22 Thread Mike Rylander
Forgot one line. See below On Mon, 22 Nov 2004 11:54:30 -0500, Mike Rylander <[EMAIL PROTECTED]> wrote: > I'm feeling sausey today, so here is my (untested) attempt to [snip] > > CREATE FUNCTION svp_getparentproviderids (@child_provider INTEGER) > > RETURNS @provider_ids TABLE ( uid INTEGER ) > >

Re: [SQL] Recursive SETOF function

2004-11-22 Thread Mike Rylander
I'm feeling sausey today, so here is my (untested) attempt to translate your function. It's inline below, and you'll want to look here http://www.postgresql.org/docs/7.4/interactive/plpgsql.html for more information. On Mon, 22 Nov 2004 09:18:13 -0600, Richard Rowell <[EMAIL PROTECTED]> wrote: >

[SQL] Missing SELECT INTO ... DEFAULT VALUES in plpgsql for composite t ypes

2004-11-22 Thread Passynkov, Vadim
Hi all Just self-explanatory code below -- var1 with default value. CREATE DOMAIN var1_type AS pg_catalog.text DEFAULT 'udp'::pg_catalog.text CONSTRAINT "var1_const" CHECK ( VALUE IS NOT NULL AND ( VALUE = 'tcp'::pg_catalog.text OR VALUE = 'udp'::pg_catalog.text ) ); -- var2 without defaul

[SQL] Recursive SETOF function

2004-11-22 Thread Richard Rowell
I'm trying to port some TSQL to PLPGSQL. The DB has a table with a recursive foreign key that represents a tree hierarchy. I'm trying to re-create a TSQL function that pulls out all the ancestors of a given node in the hierarchy. I'm rather new to PLSQL and I have several questions. 1. In TSQL

Re: [SQL] get sequence value of insert command

2004-11-22 Thread Passynkov, Vadim
> > > create sequence mysequence; > > > > > > create table foo( > > > id integer default nextval('mysequence'), > > > bla text, > > > wombat integer, > > > foobar date, > > > primary key(id) > > > ); > > > > > > insert into foo (wombat) values (88); > > > > > > now how do i know the id

Re: [SQL] Doubt :- Image_Insert

2004-11-22 Thread Rod Taylor
On Mon, 2004-11-22 at 15:09 +0100, Jerome Alet wrote: > Hi, > > On Mon, Nov 22, 2004 at 08:54:20AM -0500, Rod Taylor wrote: > > On Mon, 2004-11-22 at 19:11 +0530, sreejith s wrote: > > > Hello friends I have a doubt, > > > Is it possible to insert images into a postgres db. What is its > > > datat

Re: [SQL] Doubt :- Image_Insert

2004-11-22 Thread Jerome Alet
Hi, On Mon, Nov 22, 2004 at 08:54:20AM -0500, Rod Taylor wrote: > On Mon, 2004-11-22 at 19:11 +0530, sreejith s wrote: > > Hello friends I have a doubt, > > Is it possible to insert images into a postgres db. What is its > > datatype. Is its possible to insert jpeg images. or v have to store > > t

Re: [SQL] Doubt :- Image_Insert

2004-11-22 Thread Rod Taylor
On Mon, 2004-11-22 at 19:11 +0530, sreejith s wrote: > Hello friends I have a doubt, > Is it possible to insert images into a postgres db. What is its > datatype. Is its possible to insert jpeg images. or v have to store > the path into the db. Pls reply. its urgent. Use bytea for a datatype. Post

[SQL] Doubt :- Image_Insert

2004-11-22 Thread sreejith s
Hello friends I have a doubt, Is it possible to insert images into a postgres db. What is its datatype. Is its possible to insert jpeg images. or v have to store the path into the db. Pls reply. its urgent. Sreejith ---(end of broadcast)--- TIP 7: d