[SQL] usage of lo_import
Hi all,
Thru psql , when i try to insert into the table with the a large
object as insert into some_table values('pp','lo_import('easi.gif'));
it gives an error message as
ERROR: You must have Postgres superuser privilege to use
server-side lo_import().
Anyone can use the client-side lo_import() provided by libpq.
how do i insert if i am not logging on as postgres user. ?? and how do i
use lo_import over the network???
Thanx in advance
padmajha
Re: [SQL] Image insertion by using BLOB
Quoting Som <[EMAIL PROTECTED]>:
> Hi ALL,
> I am trying to insert the image from the client to database by
> spicifying the Windows NT machine filepath.
> The server(postgresql 7.0) is situated at the linux.
> If filepath is linux m/c's then i can ...
> If filepath is winNT then i have Exception saying :
>
> ERROR: lo_import : ca't open unix file "/jigsaw/jigsaw/www/som.gif "
> No such file or directory
>
> Query is as follows::
> insert into tablename values('som', lo_import('PATH'));
lo_import only works on the servers filesystem.
>
> If possible , how ?
You need to use the fastpath/largeobject api's to send the image over the
network connection.
There's 2 C & 1 Java examples included in the source showing this.
Peter
>
>
> -som
>
>
>
>
>
>
>
>
>
>
>
>
>
--
Peter Mount [EMAIL PROTECTED]
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/
[SQL] PL/pgSQL: possible parsing or documentation bug?
Saluton,
plpgsql seems to get confused when using variable names that coincide
with, e.g., column names:
create Function IdOfPossiblyNewAuthor(text) returns int4 as '
declare
id int4;
begin
select id into id from author where name = $1;
raise notice ''ID found: %'', id;
if id is null then
insert into author (name) values ($1);
select currval(''author_id_seq'') into id;
raise debug ''Author inserted. ID: %'', id;
end if;
return id;
end;
' language 'plpgsql' with (IsCachable);
Logically it is clear which "id" should be parsed as the variable,
which as author.id, but I have to use a different name to make this
work. I do not see any mention on this restriction of variable names
(the full extent of which I do not know) in the documentation (7.0.2).
Albert.
--
--
Albert Reiner <[EMAIL PROTECTED]>
Deutsch * English * Esperanto * Latine
--
[SQL] how to create this trigger?
I need to create a trigger that increment a value in a column of table1 where a row is inserted in table 2 I have tried whit this but it just does nothing. CREATE FUNCTION increment_value () RETURNS opaque AS 'DECLARE code int4; BEGIN code := new.code; UPDATE table1 SET value = value + 1 WHERE id = code; RETURN NEW; END;' LANGUAGE 'plpgsql'; CREATE TRIGGER insert_on_table2 BEFORE INSERT ON table2 FOR EACH ROW EXECUTE PROCEDURE increment_value(); Can you help me?
[SQL] RE: how to create this trigger?
Did you insert a row into table2? What happens if there is no row in table 1 where id = code (of the newly inserted row in table2). Seems to me you many need to consider expanding increment_value() to check table1 to see if code exists. If not insert a new value, else update. -Original Message- From: Ramiro Arenas Ramirez [SMTP:[EMAIL PROTECTED]] Sent: Thursday, February 01, 2001 2:48 PM To: [EMAIL PROTECTED] Subject:how to create this trigger? I need to create a trigger that increment a value in a column of table1 where a row is inserted in table 2 I have tried whit this but it just does nothing. CREATE FUNCTION increment_value () RETURNS opaque AS 'DECLARE code int4; BEGIN code := new.code; UPDATE table1 SET value = value + 1 WHERE id = code; RETURN NEW; END;' LANGUAGE 'plpgsql'; CREATE TRIGGER insert_on_table2 BEFORE INSERT ON table2 FOR EACH ROW EXECUTE PROCEDURE increment_value(); Can you help me?
Re: [SQL] Permissions for foreign keys
Rick Delaney wrote: > > "Ross J. Reedstrom" wrote: > > > > This is a bug that was fixed in 7.1beta for sure, but also 7.0.3, > > I believe. So it's as simple as upgrading. > > Thanks, I'll upgrade. I couldn't find this listed in any changes files > so can you (or anyone) confirm that this is fixed in 7.0.3? For the record, this is NOT fixed in 7.0.3. I will try the beta which I finally managed to find. It is at ftp://ftp.postgresql.org/pub/dev/ for those like me who constantly get timed out using the search engine at postgresql.org. -- Rick Delaney
Re: [SQL] how to create this trigger?
Don't know much, but couldn't you let increment_value take an argument and run it on new.code? But maybe I am completely off. Albert. On Thu, Feb 01, 2001 at 04:48:28PM -0500, Ramiro Arenas Ramírez wrote: > I need to create a trigger that increment a value in a column > of table1 where a row is inserted in table 2 > > I have tried whit this but it just does nothing. > > CREATE FUNCTION increment_value () RETURNS opaque AS > 'DECLARE >code int4; >BEGIN >code := new.code; >UPDATE table1 >SET value = value + 1 >WHERE id = code; > RETURN NEW; > END;' LANGUAGE 'plpgsql'; > > CREATE TRIGGER insert_on_table2 BEFORE INSERT ON table2 > FOR EACH ROW EXECUTE PROCEDURE increment_value(); > > > Can you help me? > > > > -- -- Albert Reiner <[EMAIL PROTECTED]> Deutsch * English * Esperanto * Latine --
Re: [SQL] Permissions for foreign keys
Rick - Thanks for checking that. I should've done it myself. Sorry I didn't respond when you asked for confirmation. Ross On Thu, Feb 01, 2001 at 05:38:12PM -0500, Rick Delaney wrote: > Rick Delaney wrote: > > > > "Ross J. Reedstrom" wrote: > > > > > > This is a bug that was fixed in 7.1beta for sure, but also 7.0.3, > > > I believe. So it's as simple as upgrading. > > > > Thanks, I'll upgrade. I couldn't find this listed in any changes files > > so can you (or anyone) confirm that this is fixed in 7.0.3? > > For the record, this is NOT fixed in 7.0.3. I will try the beta which I > finally managed to find. It is at > > ftp://ftp.postgresql.org/pub/dev/ > > for those like me who constantly get timed out using the search engine > at postgresql.org. > > -- > Rick Delaney
