Re: [SQL] Control reached end of trigger procedure without RETURN
El 24/01/2011 19:19, Andrej escribió: > And, since the list is in English - please translate? I'm sorry, I started writing and the language ... :-( I have a function that is triggered in a trigger whose purpose is, create a record in another table or update and return the id of the record created / modified to save in the table from being called. Try to explain it better: TableA -> Launch the trigger and I want to save the modified record id / created in Table B. TableB -> Is a summary table of TableA and is updated from TableA trigger. Purpose -> Update TableB from TableA and store in the record of TableA the Id of record TableB. When I launch one insert returns error: I put the function and the returned error. Thanks in advance, Best regards. *** CODE *** CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() RETURNS trigger AS $BODY$ DECLARE id_ventas_imp integer; -- Taxes Id. id_ventas_cab integer; -- Bill Id. val_neto numeric(19,4); -- net value. val_imp numeric(19,4); -- tax value. BEGIN -- IF (TG_OP = 'DELETE') THEN -- Descontar valor old.. val_neto:= -1 * OLD.total_neto; val_imp:= -1 * OLD.valor_imp; RAISE DEBUG 'Deleted: net % tax % ', val_neto, val_imp; ELSIF (TG_OP = 'UPDATE') THEN -- If you change the tax, substract the amount value. IF ((OLD.por_impto != NEW.por_impto) AND (OLD.por_impto IS NOT NULL) AND (NEW.ventas_cab_id IS NOT NULL)) THEN RAISE DEBUG '--'; -- Substract the od value. val_neto:= -1 * OLD.total_neto; val_imp:= -1 * OLD.valor_imp; UPDATE ventas_imp SET suma_neto=suma_neto+val_neto, suma_imp=suma_imp+val_imp, total_con_imp=round(suma_neto+suma_imp) WHERE ventas_cab_id=NEW.ventas_cab_id AND por_impto=OLD.por_impto; RAISE DEBUG ' -- '; END IF; -- Substract old value and add new value. val_neto:=NEW.total_neto-OLD.total_neto; val_imp:=NEW.valor_imp-OLD.valor_imp; RAISE DEBUG 'Modify: net % tax % ', val_neto, val_imp; ELSIF (TG_OP = 'INSERT') THEN -- Add NEW value. val_neto:=NEW.total_neto; val_imp:=NEW.valor_imp; RAISE INFO 'New: net % tax % ', val_neto, val_imp; END IF; -- update with new values and returning it the "id" of the updated record . UPDATE ventas_imp SET suma_neto=suma_neto + val_neto, valor_imp=valor_imp + val_imp, total_con_imp=round(suma_neto + valor_imp, 2) WHERE ventas_cab_id=NEW.ventas_cab_id AND por_impto=NEW.por_impto RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Update done in record_id % ', id_ventas_imp; -- If not found, insert new record and return "id". IF (NOT FOUND) THEN BEGIN -- . INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( NEW.ventas_cab_id, NEW.por_impto, val_neto, val_imp, round(val_neto+val_imp, 2) ) RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Not found. New record = % ', id_ventas_imp; EXCEPTION -- Two transactions trying to create the record. WHEN UNIQUE_VIOLATION THEN UPDATE ventas_imp SET suma_neto=suma_neto + val_neto, valor_imp=valor_imp + val_imp, total_con_imp=round(suma_neto + valor_imp, 2) WHERE ventas_cab_id=NEW.ventas_cab_id AND por_impto=NEW.por_impto RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Two transactions trying to create the record: I launch update in record_id % ', id_ventas_imp; END; END IF; -- Delete records with amount=0. DELETE FROM ventas_imp WHERE ventas_cab_id=id_ventas_cab AND (total_con_imp=0 OR total_con_imp IS NULL); RAISE DEBUG 'Delete records with amount=0 or null '; -- I save the record_id of table ventas_imp and return the updated record. NEW.total_con_imp := round(total_neto + valor_imp, 2); -- Update calculations. NEW.ventas_imp_id := id_ventas_imp; RAISE DEBUG 'New of record values: Total with tax = % Record Id of tax table= ', NEW.total_con_imp, NEW.ventas_imp_id; return NEW; END $BODY$ LANGUAGE 'plpgsql' VOLATILE ## INFO: Nuevo: neto 5. impuesto 0.5000 ERROR: control reached end of trigger procedure without RETURN CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" SQL statement "INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( $1 , $2 , $3 , $4 , round( $3 + $4 , 2) ) RETURNING ventas_imp_id" PL/pgSQL function "ventas_det_a_ventas_imp" line 56 at SQL statement ** Error ** ERROR: control reached end of trigger procedure without RETURN Estado SQL:2F005 Contexto:PL/pgSQL function "ventas_imp_a_ventas_cab" SQL statement "INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( $1 , $2 , $3 , $4 , round( $3 + $4 , 2) ) RETURNING ventas_imp_id" PL/pgSQL function "ventas_det_a_ventas_imp" line 56 at SQL statement ## the #56 line is the INSERT instruction in the block IF (NOT FOUND) THEN BEGIN -- INSERT INTO ventas_imp ( -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Control reached end of trigger procedure without RETURN
El 24/01/2011 19:19, Andrej escribió: > And, since the list is in English - please translate? I'm sorry, I started writing and the language ... :-( I have a function that is triggered in a trigger whose purpose is, create a record in another table or update and return the id of the record created / modified to save in the table from being called. Try to explain it better: TableA -> Launch the trigger and I want to save the modified record id / created in Table B. TableB -> Is a summary table of TableA and is updated from TableA trigger. Purpose -> Update TableB from TableA and store in the record of TableA the Id of record TableB. When I launch one insert returns error: I put the function and the returned error. Thanks in advance, Best regards. *** CODE *** CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() RETURNS trigger AS $BODY$ DECLARE id_ventas_imp integer; -- Taxes Id. id_ventas_cab integer; -- Bill Id. val_neto numeric(19,4); -- net value. val_imp numeric(19,4); -- tax value. BEGIN -- IF (TG_OP =DELETE') THEN -- Descontar valor old.. val_neto:=1 * OLD.total_neto; val_imp:=1 * OLD.valor_imp; RAISE DEBUG 'Deleted: net % tax % ', val_neto, val_imp; ELSIF (TG_OP =UPDATE') THEN -- If you change the tax, substract the amount value. IF ((OLD.por_impto !=EW.por_impto) AND (OLD.por_impto IS NOT NULL) AND (NEW.ventas_cab_id IS NOT NULL)) THEN RAISE DEBUG '--'; -- Substract the od value. val_neto:=1 * OLD.total_neto; val_imp:=1 * OLD.valor_imp; UPDATE ventas_imp SET suma_neto=ma_neto+val_neto, suma_imp=ma_imp+val_imp, total_con_imp=und(suma_neto+suma_imp) WHERE ventas_cab_id=W.ventas_cab_id AND por_impto=D.por_impto; RAISE DEBUG ' -- '; END IF; -- Substract old value and add new value. val_neto:=W.total_neto-OLD.total_neto; val_imp:=W.valor_imp-OLD.valor_imp; RAISE DEBUG 'Modify: net % tax % ', val_neto, val_imp; ELSIF (TG_OP =INSERT') THEN -- Add NEW value. val_neto:=W.total_neto; val_imp:=W.valor_imp; RAISE INFO 'New: net % tax % ', val_neto, val_imp; END IF; -- update with new values and returning it the "id" of the updated record . UPDATE ventas_imp SET suma_neto=ma_neto + val_neto, valor_imp=lor_imp + val_imp, total_con_imp=und(suma_neto + valor_imp, 2) WHERE ventas_cab_id=W.ventas_cab_id AND por_impto=W.por_impto RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Update done in record_id % ', id_ventas_imp; -- If not found, insert new record and return "id". IF (NOT FOUND) THEN BEGIN -- . INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( NEW.ventas_cab_id, NEW.por_impto, val_neto, val_imp, round(val_neto+val_imp, 2) ) RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Not found. New record =% ', id_ventas_imp; EXCEPTION -- Two transactions trying to create the record. WHEN UNIQUE_VIOLATION THEN UPDATE ventas_imp SET suma_neto=ma_neto + val_neto, valor_imp=lor_imp + val_imp, total_con_imp=und(suma_neto + valor_imp, 2) WHERE ventas_cab_id=W.ventas_cab_id AND por_impto=W.por_impto RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Two transactions trying to create the record: I launch update in record_id % ', id_ventas_imp; END; END IF; -- Delete records with amount= DELETE FROM ventas_imp WHERE ventas_cab_id=_ventas_cab AND (total_con_imp=OR total_con_imp IS NULL); RAISE DEBUG 'Delete records with amount=or null '; -- I save the record_id of table ventas_imp and return the updated record. NEW.total_con_imp :=ound(total_neto + valor_imp, 2); -- Update calculations. NEW.ventas_imp_id :=d_ventas_imp; RAISE DEBUG 'New of record values: Total with tax = Record Id of tax table=, NEW.total_con_imp, NEW.ventas_imp_id; return NEW; END $BODY$ LANGUAGE 'plpgsql' VOLATILE ## INFO: Nuevo: neto 5. impuesto 0.5000 ERROR: control reached end of trigger procedure without RETURN CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" SQL statement "INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( $1 , $2 , $3 , $4 , round( $3 + $4 , 2) ) RETURNING ventas_imp_id" PL/pgSQL function "ventas_det_a_ventas_imp" line 56 at SQL statement ** Error ** ERROR: control reached end of trigger procedure without RETURN Estado SQL:2F005 Contexto:PL/pgSQL function "ventas_imp_a_ventas_cab" SQL statement "INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( $1 , $2 , $3 , $4 , round( $3 + $4 , 2) ) RETURNING ventas_imp_id" PL/pgSQL function "ventas_det_a_ventas_imp" line 56 at SQL statement ## the #56 line is the INSERT instruction in the block IF (NOT FOUND) THEN BEGIN -- INSERT INTO ventas_imp ( -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Queyring for columns which are exist in table.
Hi All,
I want to fire a query such that if the particular column does not exist
then query should return some default value.
For that I have tried following experiment.
CREATE TABLE tbl (
c1 integer,
c2 integer,
c3 integer
);
INSERT INTO tbl VALUES (1, 2, 3);
INSERT INTO tbl VALUES (2, 3, 4);
INSERT INTO tbl VALUES (3, 4, 5);
INSERT INTO tbl VALUES (4, 5, 6);
INSERT INTO tbl VALUES (5, 6, 7);
INSERT INTO tbl VALUES (6, 7, 8);
INSERT INTO tbl VALUES (7, 8, 9);
INSERT INTO tbl VALUES (8, 9, 10);
CREATE OR REPLACE FUNCTION ColumnAlreadyExists(name, name) RETURNS
INTEGER AS E'
DECLARE columnCount INTEGER;
BEGIN
SELECT COUNT (pg_attribute.attname) into columnCount FROM
pg_attribute,pg_class, pg_type WHERE
((pg_attribute.attrelid=pg_class.oid) AND
(pg_attribute.atttypid=pg_type.oid) AND (pg_class.relname = $1) AND
(pg_attribute.attname = $2));
IF columnCount = 0 THEN
RETURN 0;
END IF;
RETURN 1;
END;
' LANGUAGE 'plpgsql';
DROP FUNCTION checkColumn(name,name,name);
CREATE OR REPLACE FUNCTION checkColumn(name, name, name) RETURNS name AS
E'
DECLARE isColumnExist INTEGER;
BEGIN
SELECT ColumnAlreadyExists ($1,$2) into isColumnExist;
IF isColumnExist = 0 THEN
RETURN name($3);
ELSE
RETURN name($2);
END IF;
END;
' LANGUAGE 'plpgsql';
Function checkColumn should return proper column name (second parameter)
if column exist and third parameter if column not exist.
NOW when I try to execute following command it returns improper result.
I expect proper column values as a output of query.
SELECT(checkColumn('tbl','c2','0'))::name FROM tbl;
mydb=# SELECT (checkColumn('tbl','c2','0'))::name FROM tbl;
checkcolumn
-
c2
c2
c2
c2
c2
c2
c2
c2
(8 rows)
mydb=#
Above query should return actual values present for c2 column in tbl.
But it's not working as desired.
Please help me in this.
Thanks in advance,
Santosh.
Re: [SQL] Control reached end of trigger procedure without RETURN
MoNiLlO writes: > When I launch one insert returns error: > I put the function and the returned error. > CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() > RETURNS trigger AS > ... > ERROR: control reached end of trigger procedure without RETURN > CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" The function that's lacking a RETURN is not the one you're showing us. regards, tom lane -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Control reached end of trigger procedure without RETURN
El 25/01/2011 16:06, Tom Lane escribió: > MoNiLlO writes: >> When I launch one insert returns error: >> I put the function and the returned error. >> CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() >> RETURNS trigger AS >> ... >> ERROR: control reached end of trigger procedure without RETURN >> CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" > The function that's lacking a RETURN is not the one you're showing us. > > regards, tom lane > Thanks for open my eyes. Great stupidity to mine. This is a second trigger that has no code and therefore there is no return. I feel the lost of time. Best regards. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Control reached end of trigger procedure without RETURN
El 24/01/2011 19:19, Andrej escribió: > And, since the list is in English - please translate? I'm sorry, I started writing and the language ... :-( I have a function that is triggered in a trigger whose purpose is, create a record in another table or update and return the id of the record created / modified to save in the table from being called. Try to explain it better: TableA -> Launch the trigger and I want to save the modified record id / created in Table B. TableB -> Is a summary table of TableA and is updated from TableA trigger. Purpose -> Update TableB from TableA and store in the record of TableA the Id of record TableB. When I launch one insert returns error: I put the function and the returned error. Thanks in advance, Best regards. *** CODE *** CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() RETURNS trigger AS $BODY$ DECLARE id_ventas_imp integer; -- Taxes Id. id_ventas_cab integer; -- Bill Id. val_neto numeric(19,4); -- net value. val_imp numeric(19,4); -- tax value. BEGIN -- IF (TG_OP =DELETE') THEN -- Descontar valor old.. val_neto:=1 * OLD.total_neto; val_imp:=1 * OLD.valor_imp; RAISE DEBUG 'Deleted: net % tax % ', val_neto, val_imp; ELSIF (TG_OP =UPDATE') THEN -- If you change the tax, substract the amount value. IF ((OLD.por_impto !=EW.por_impto) AND (OLD.por_impto IS NOT NULL) AND (NEW.ventas_cab_id IS NOT NULL)) THEN RAISE DEBUG '--'; -- Substract the od value. val_neto:=1 * OLD.total_neto; val_imp:=1 * OLD.valor_imp; UPDATE ventas_imp SET suma_neto=ma_neto+val_neto, suma_imp=ma_imp+val_imp, total_con_imp=und(suma_neto+suma_imp) WHERE ventas_cab_id=W.ventas_cab_id AND por_impto=D.por_impto; RAISE DEBUG ' -- '; END IF; -- Substract old value and add new value. val_neto:=W.total_neto-OLD.total_neto; val_imp:=W.valor_imp-OLD.valor_imp; RAISE DEBUG 'Modify: net % tax % ', val_neto, val_imp; ELSIF (TG_OP =INSERT') THEN -- Add NEW value. val_neto:=W.total_neto; val_imp:=W.valor_imp; RAISE INFO 'New: net % tax % ', val_neto, val_imp; END IF; -- update with new values and returning it the "id" of the updated record . UPDATE ventas_imp SET suma_neto=ma_neto + val_neto, valor_imp=lor_imp + val_imp, total_con_imp=und(suma_neto + valor_imp, 2) WHERE ventas_cab_id=W.ventas_cab_id AND por_impto=W.por_impto RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Update done in record_id % ', id_ventas_imp; -- If not found, insert new record and return "id". IF (NOT FOUND) THEN BEGIN -- . INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( NEW.ventas_cab_id, NEW.por_impto, val_neto, val_imp, round(val_neto+val_imp, 2) ) RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Not found. New record =% ', id_ventas_imp; EXCEPTION -- Two transactions trying to create the record. WHEN UNIQUE_VIOLATION THEN UPDATE ventas_imp SET suma_neto=ma_neto + val_neto, valor_imp=lor_imp + val_imp, total_con_imp=und(suma_neto + valor_imp, 2) WHERE ventas_cab_id=W.ventas_cab_id AND por_impto=W.por_impto RETURNING ventas_imp_id INTO id_ventas_imp; RAISE DEBUG 'Two transactions trying to create the record: I launch update in record_id % ', id_ventas_imp; END; END IF; -- Delete records with amount= DELETE FROM ventas_imp WHERE ventas_cab_id=_ventas_cab AND (total_con_imp=OR total_con_imp IS NULL); RAISE DEBUG 'Delete records with amount=or null '; -- I save the record_id of table ventas_imp and return the updated record. NEW.total_con_imp :=ound(total_neto + valor_imp, 2); -- Update calculations. NEW.ventas_imp_id :=d_ventas_imp; RAISE DEBUG 'New of record values: Total with tax = Record Id of tax table=, NEW.total_con_imp, NEW.ventas_imp_id; return NEW; END $BODY$ LANGUAGE 'plpgsql' VOLATILE ## INFO: Nuevo: neto 5. impuesto 0.5000 ERROR: control reached end of trigger procedure without RETURN CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" SQL statement "INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( $1 , $2 , $3 , $4 , round( $3 + $4 , 2) ) RETURNING ventas_imp_id" PL/pgSQL function "ventas_det_a_ventas_imp" line 56 at SQL statement ** Error ** ERROR: control reached end of trigger procedure without RETURN Estado SQL:2F005 Contexto:PL/pgSQL function "ventas_imp_a_ventas_cab" SQL statement "INSERT INTO ventas_imp ( ventas_cab_id, por_impto, suma_neto, valor_imp, total_con_imp) VALUES ( $1 , $2 , $3 , $4 , round( $3 + $4 , 2) ) RETURNING ventas_imp_id" PL/pgSQL function "ventas_det_a_ventas_imp" line 56 at SQL statement ## the #56 line is the INSERT instruction in the block IF (NOT FOUND) THEN BEGIN -- INSERT INTO ventas_imp ( -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] create geometry by lat/long
how to create geometry (EPSG:4326) by lat/long. plz advice -- View this message in context: http://postgresql.1045698.n5.nabble.com/create-geometry-by-lat-long-tp3356073p3356073.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Control reached end of trigger procedure without RETURN
El 25/01/2011 16:06, Tom Lane escribió: > MoNiLlO writes: >> When I launch one insert returns error: >> I put the function and the returned error. >> CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() >> RETURNS trigger AS >> ... >> ERROR: control reached end of trigger procedure without RETURN >> CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" > The function that's lacking a RETURN is not the one you're showing us. > > regards, tom lane > Thanks for open my eyes. Great stupidity to mine. This is a second trigger that has no code and therefore there is no return. I feel the lost of time. Best regards. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Control reached end of trigger procedure without RETURN
El 25/01/2011 16:06, Tom Lane escribió: > MoNiLlO writes: >> When I launch one insert returns error: >> I put the function and the returned error. >> CREATE OR REPLACE FUNCTION ventas_det_a_ventas_imp() >> RETURNS trigger AS >> ... >> ERROR: control reached end of trigger procedure without RETURN >> CONTEXT: PL/pgSQL function "ventas_imp_a_ventas_cab" > The function that's lacking a RETURN is not the one you're showing us. > > regards, tom lane > Thanks for open my eyes. Great stupidity to mine. This is a second trigger that has no code and therefore there is no return. I feel the lost of time. Best regards. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] control function pgsql with script bash
Good morning I want to check if the function pgsql execute correctly into my bash script . I have something like this : /var/lib/pgsql/bin/./psql -U 'USER' -d DATABSE -p 5432 -h iphost -c "select antros.changethenames( )" how can i get the error if the function changethenames() send me one. ? thnks
Re: [SQL] create geometry by lat/long
On Tue, Jan 25, 2011 at 03:10:59AM -0800, gargdevender74 wrote: > > how to create geometry (EPSG:4326) by lat/long. plz advice Try ST_Point and ST_SetSRID() http://www.postgis.org/docs/ST_Point.html -- Joshua Tolley / eggyknap End Point Corporation http://www.endpoint.com signature.asc Description: Digital signature
Re: [SQL] control function pgsql with script bash
On Tue, Jan 25, 2011 at 10:46:58AM -0600, manuel antonio ochoa wrote: > Good morning > > I want to check if the function pgsql execute correctly into my bash > script . > I have something like this : > > /var/lib/pgsql/bin/./psql -U 'USER' -d DATABSE -p 5432 -h iphost -c > "select antros.changethenames( )" > > how can i get the error if the function changethenames() send me one. ? > > thnks See http://www.postgresql.org/docs/9.0/static/app-psql.html#AEN74212 Turn on ON_ERROR_STOP, and psql will give you an exit status of 3 when something goes wrong in your script. I don't know of a way, aside from parsing the output, that you can identify exactly where the problem arose. -- Joshua Tolley / eggyknap End Point Corporation http://www.endpoint.com signature.asc Description: Digital signature
[SQL] Benchmarking
hello do you know a tool to benchmark my dbase and the basic test that I need to do ? I found a pgbench !!! ...
Re: [SQL] Benchmarking
On Tue, Jan 25, 2011 at 10:39 AM, manuel antonio ochoa wrote: > hello > > do you know a tool to benchmark my dbase and the basic test that I need to > do ? > I found a pgbench !!! ... pgbench can be used as a generic testing tool by giving it a new set of sql statements to run with the -f switch. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] pgbench tools
Hello, I run ./runtest it begin and insert some tuples like 1000 tuples done. and the i have this problem : Run set #3 of 3 with 16 clients scale=100 Running tests using: psql -h 192.170.1.82 -U postgres -p 5432 -d pgbench Storing results using: psql -h 192.170.1.82 -U postgres -p 5432 -d results ./benchwarmer: línea 93: psql: no se encontró la orden ERROR: Attempt to determine database scale returned "", aborting Run set #3 of 3 with 32 clients scale=100 Running tests using: psql -h 192.170.1.82 -U postgres -p 5432 -d pgbench Storing results using: psql -h 192.170.1.82 -U postgres -p 5432 -d results ./benchwarmer: línea 93: psql: no se encontró la orden ERROR: Attempt to determine database scale returned "", aborting ./webreport: línea 23: psql: no se encontró la orden ./webreport: línea 24: gnuplot: no se encontró la orden mv: no se puede efectuar `stat' sobre «scaling.png»: No existe el fichero o el directorio ./webreport: línea 28: psql: no se encontró la orden ./webreport: línea 29: gnuplot: no se encontró la orden mv: no se puede efectuar `stat' sobre «clients.png»: No existe el fichero o el directorio ./webreport: línea 33: psql: no se encontró la orden ./webreport: línea 34: gnuplot: no se encontró la orden mv: no se puede efectuar `stat' sobre «3d.png»: No existe el fichero o el directorio ./webreport: línea 40: results/index.htm: No existe el fichero o el directorio ./webreport: línea 41: results/index.htm: No existe el fichero o el directorio ./webreport: línea 42: results/index.htm: No existe el fichero o el directorio ./webreport: línea 43: results/index.htm: No existe el fichero o el directorio ./webreport: línea 46: psql: no se encontró la orden rm: no se puede borrar «temp.txt»: No existe el fichero o el directorio which could be the problem ? .. thnks
Re: [SQL] Queyring for columns which are exist in table.
Why would not use information schema to checking of existence of some column in a table: select column_name from information_schema.columns where table_name='tbl' -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
