[SQL] possible to lock a single row in table?

2001-06-20 Thread Bruno Boettcher
Hello! i have a lots of threads that work on a table, making insertions, updates removes. now i certain cases its important to keep data integrity, so i looked into locks all i found was a lock function that locks the entire table now even in shared mode, if i understand it well th

[SQL] where's ALTER TABLE table DROP [ COLUMN ] column???

2001-05-23 Thread Bruno Boettcher
Hello! just trying to write an upgrade script for my bookkeeping system and noticed that it seems that i can't throw out the legacy stuff accumulated over time as far as i can tell, i can add columns to a table, but can't remove them later on. is this true? any easy way to circumv

[SQL] how to set ownership of tables?

2001-05-21 Thread Bruno Boettcher
Hello! how can i change the ownership of a table? i have the problem that i create table with CONSTRAINTS on other tables, those others have a different owner... and thus the creation of the table is refused is it possible to make constraints on tables whithout having their ownership? is it

[SQL] how to check presence of a function and set permissions?

2001-05-21 Thread Bruno Boettcher
hello! since i am now destroying and recreating my functions at every request (due to the fact that pl/psql can't cope with dynamic table names, and i didn't found anywhere a decent doc about pl/perl) i have now the problem, that a psql error is displayed if i try to drop a nonexistent function,

[SQL] HELP: what's wrong with my PL/PSQL function??

2001-05-18 Thread Bruno Boettcher
hello! i have the following function: CREATE FUNCTION plusSum(text,int4) RETURNS int4 AS ' DECLARE jrlname ALIAS FOR $1; sumup ALIAS FOR $2; actsum int4; arow RECORD; conversion float8; temp float8; sum float8; BEGIN sum := 0; RAISE NOTICE ''stats % '', sumup; FOR arow IN

[SQL] no more pg_dump cause of multiple declared database??

2001-05-09 Thread Bruno Boettcher
Hello a problem i am encountering quite frequently lately. for some reason my databases are registered under several users and making a pg_dump gives me the following error: getDatabase(): SELECT failed. Explanation from backend: 'ERROR: More than one tuple returned by a subselect used as

[SQL] replace??

2000-12-19 Thread Bruno Boettcher
hello, i have the following problem: i have in php an array structure with user-prefs that have to be stored onto DB actually i look up if the corresponding entry exists (comparing user-name and field-name) if yes i update, if no i insert this isn't very appealing, but i couldn't find a

[SQL] Postgres closing the connection too fast with php4+apache

2000-12-13 Thread Bruno Boettcher
Hello, in old days i was used to open the connection to my DB at the begin of the script, make lots of stuff inside the script and eventually close the connection at the end (even if php is supposed to do it for me...). This stopped to work now each time i make a call to the DB i connect, ma

[SQL] HELP: can i have a trigger before postgres tries to check data types?

2000-12-12 Thread Bruno Boettcher
hello, now that i finally managed to write some functions and triggers in perl, i get the following error: insert into journal (plus,minus,description,currency,amount) VALUES (101,420,'a test','EUR','1.000.000'); ERROR: pg_atoi: error in "1.000.000": can't parse ".000.000" normal since the

Re: [SQL] what's wrong with my plperl function?

2000-12-06 Thread Bruno Boettcher
On Wed, Dec 06, 2000 at 05:52:13PM +0100, Bruno Boettcher wrote: > $work =~s/\.//g; ehm yeah stupid me... think i even read it somewhere in the docu should be $work =~ s/\\.//g; :( at least it works now... -- ciao bboett == [EM

Re: [SQL] what's wrong with my plperl function?

2000-12-06 Thread Bruno Boettcher
On Wed, Dec 06, 2000 at 10:54:58AM -0500, Tom Lane wrote: > I'm confused too... :D > I don't see why print wouldn't work. Realize however that it will > go to the postmaster's stdout, so you'd better not have started the yep found it in the log > Also, it looks like plperl supports elog(NOT

[SQL] what's wrong with my plperl function?

2000-12-06 Thread Bruno Boettcher
Hello, i am still at the same stage thanks to Oliver Elphick the plperl module is working, as a stand alone per program the thing works (sole difference, i use $toparse = shift; instead of the $toparse = $_[0]; in the sql-function here's the thing: CREATE FUNCTION cleanFromSep(text,tex

[SQL] reinitialize a sequence?

2000-12-04 Thread Bruno Boettcher
hello, played a bit around with the serial type wanted to adapt my already existing tables to this system... dumped the DB, created the new tables, loaded old data in all works, until i try to insert something without specifying the id field (that's the now sequential field). And the reas

[SQL] removing a DB??

2000-11-27 Thread Bruno Boettcher
hello, i have a nice command to create a db 'createdb', but hows when you want to get rid of a DB?? searched for a removedb script Took me some time to read through the man page, find out how the command actually works, look up the SQL commands and find out that there's also a DROP DATABASE

[SQL] is there a debian package for plperl?

2000-11-23 Thread Bruno Boettcher
Hello, subject says it all, wanted to give plperl a try, but the lib doesn't seem installed... now i installed all through debian packaging system, and the lib surely is somewhere, but i didn't found it yet... so i anybody could point on on where to search for it... -- ciao bboett =

Re: [SQL] pgpl-problem, what's wrong with my loop?

2000-11-20 Thread Bruno Boettcher
On Mon, Nov 20, 2000 at 06:06:52PM +0100, Kovacs Zoltan Sandor wrote: > > FOR arow IN SELECT currency,amount FROM journal WHERE col=sumup LOOP > My opinion is the problem that you cannot give a column name as a > parameter. But I'm not sure. This never worked for me. The thing here :( can somebo

[SQL] pgpl-problem, what's wrong with my loop?

2000-11-20 Thread Bruno Boettcher
Hello, once more, i ran into a problem i got no syntax error, i don't know how to debug, except for raising exceptions the loop never executes making the select call by hand with fixed values, returns a result... but the second raise is never passed with the function...so something

[SQL] numeric conversions?

2000-11-20 Thread Bruno Boettcher
Hello, me again :( i just ran into another problem didn't found it neither in the doc nor in the FAQ. the currencies conversion factors i use are stored as float4 in a table, the values to apply on are stores as int4 is the type casting done automaticly? how? can i have an influenc

Re: [SQL] More stupid questions: prettyprinting of ints??

2000-11-20 Thread Bruno Boettcher
yeah forgot another thing i want also to write a SQL trigger to parse incoming fields for preprocessing before DB insertion in perl i would do a thing like that: $format = ".999.999,99"; #took out of DB... #inserting a number into the db $theval =~ s/\.//g; if($theval =~/\S+,\d{2

[SQL] More stupid questions: prettyprinting of ints??

2000-11-20 Thread Bruno Boettcher
hello, the thing i am making is a bookkepping program. This program handles multiple currencies, each currency is formatted a bit differently on from the other. I do store the amounts as int's in the DB... In another table i have sample format strings that could be used to format them... but if

[SQL] search and replace possible on SQL?

2000-11-16 Thread Bruno Boettcher
hello, again fiddling around with SQL... wanted to loop over the Base search for Strings beginning with a sequence and replace that sequence with another one. tryed the following: update journal set description='Add '||(select id description from journal subq where subq.description like '%PS

[SQL] PL/PGSQL beginning is hard....

2000-11-02 Thread Bruno Boettcher
hello, i am a beginner at SQL and PL/pgsql and thus have some surely already known problems... i have set up some tables, and wanted to play around with inbuild functions, and set up the following function: CREATE FUNCTION balance (int4) RETURNS int4 AS ' DECLARE compte ALIAS FOR