Re: [SQL] cursor and for update

2006-03-28 Thread Maciej Piekielniak
Hello Wiebe, Tuesday, March 28, 2006, 2:42:20 AM, you wrote: >> WC> Fist, what's the error you get? ERROR: missing ".." at end of SQL expression CONTEXT: compile of PL/pgSQL function "uporzadkuj_reguly" near line 7 WC> Second, what does "rekord" do? You don't seem to use it. Yes, i don't nee

[SQL] cursor and for update

2006-03-27 Thread Maciej Piekielniak
Hello , I try to translate my old functions from oracle but don't understand what is wrong. create or replace function uporzadkuj_reguly(text,text) RETURNS integer AS ' DECLARE tabela ALIAS FOR $1; lancuch ALIAS FOR $2; ret integer:=0; licznik integer:=1; rekord firewall%ROWTYPE; reguly C

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, Wednesday, March 22, 2006, 8:35:33 PM, you wrote: MB>Send an EXPLAIN ANALYZE of the query along with the description of the MB>involved tables. Also hardware information (RAM, disks, CPU), what MB>other applications are running on that box and the parameter values in MB>postgresql.c

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, Wednesday, March 22, 2006, 8:12:35 PM, you wrote: MB> Well, send the table descriptions, please. \d towar max3 | smallint | default 0 max4 | smallint | default 0 typik | character varying(1) | default '_'::c

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, Oryginal query return 7881 rows , your query only 729 rows. -- Best regards, Maciejmailto:[EMAIL PROTECTED] ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, Sorry, I try this: SELECT towar.id_towar, towar.key2, towar.nazwa, 0 AS min, 0 AS max, towar.ilosc_jed, towar.ilosc_nom, towar.ilosc_paczkowa, dostawcy.id_dostawcy, jednostka_miary.jednostka, 0.0

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, ERROR: column "foo.z_zamowien" must appear in the GROUP BY clause or be used in an aggregate function -- Best regards, Maciejmailto:[EMAIL PROTECTED] ---(end of broadcast)--- TIP 5: don't forget to inc

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, Wednesday, March 22, 2006, 7:32:11 PM, you wrote: MB> foo.z_zamowien, MB> ) AS foo ON (foo.id_towar = towar.id_towar) foo? -- Best regards, Maciejmailto:[EMAIL PROTECTED] ---(end of broadcast)-

Re: [SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello Markus, Wednesday, March 22, 2006, 6:58:44 PM, you wrote: MB> Send an EXPLAIN ANALYZE of the query along with the description of the MB> involved tables. Also hardware information (RAM, disks, CPU), what MB> other applications are running on that box and the parameter values in MB> postgres

[SQL] How to optimize this query?

2006-03-22 Thread Maciej Piekielniak
Hello pgsql-sql, I have postgresql 8.1.3 and database with about 2,7GB (90% large objects). When I execute this query postgresql calculate this 2min 50sec. How can I optimize this query? select towar.id_towar,towar.key2,towar.nazwa,0 as min,0 as max,towar.ilosc_jed,towar.ilosc

[SQL] pg_dump and diffrent sizes

2006-03-03 Thread Maciej Piekielniak
Hello pgsql-sql, I dump db with pg_dump v.8.1.3 on database postgresql server 7.4.7. Data directory with my db on pg 7.4.7 had 1,8GB and file with dump had 2,7GB. Database have blob fields. When I restore db on pg 8.1 - data directory have only 1GB, why? -- Best regards, Maciej

Re: [SQL] dump with lo

2006-03-02 Thread Maciej Piekielniak
Hello Tom, Thursday, March 2, 2006, 4:21:22 PM, you wrote: TL> Maciej Piekielniak <[EMAIL PROTECTED]> writes: >>I try copy my old database with large objects from postgresql7.4 to >>postgresql-8.1. >>How can I dump database with lo? pg_dumpall don't

[SQL] dump with lo

2006-03-02 Thread Maciej Piekielniak
Hello pgsql-sql, I try copy my old database with large objects from postgresql7.4 to postgresql-8.1. How can I dump database with lo? pg_dumpall don't save lo. -- Best regards, Maciej mailto:[EMAIL PROTECTED] ---(end of broadcast)-

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Stephan, Wednesday, February 15, 2006, 9:03:26 PM, you wrote: SS> Not in 7.4, but I believe 8.1 allows that (ALTER TABLE ALTER COLUMN TYPE SS> with semi-optional USING) Thx for all. -- Best regards, Maciejmailto:[EMAIL PROTECTED] ---

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Owen, Wednesday, February 15, 2006, 8:56:05 PM, you wrote: >> ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL; OJ> Not under 7.4. Hmm, maybe postgres can copy constraints and properties in "create table .. as select"? CREATE TABLE fv_wystawione ( abonament) AS SELECT a.nazwa

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Owen, Wednesday, February 15, 2006, 8:31:17 PM, you wrote: OJ> Note that prior to 8.0 PostgreSQL does not support multiple ALTER actions in a single query. To get an equivalent effect, wrap separate ALTER TABLE queries in a transaction: OJ> BEGIN; OJ> alter table xyz alter column id set

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Andreas, Wednesday, February 15, 2006, 8:27:00 PM, you wrote: AK> test=# select version(); AK>version AK> -- AK> PostgreSQL 8.1.2

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Andreas, Wednesday, February 15, 2006, 7:54:28 PM, you wrote: AK> test=# alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default ''; PGAdmin-SQL: alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default ''; ERROR:

[SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello , How can i modify few fields with alter? ALTER TABLE fv_wystawione ALTER id_fv SET DEFAULT nextval('id_fv_seq'::text), ALTER imie SET DEFAULT ''; Syntax error in last line. -- Best regards, Maciej mailto:[EMAIL PROTECTED] ---(en

Re: [SQL] create table and data types

2006-02-14 Thread Maciej Piekielniak
Hello Ken, Tuesday, February 14, 2006, 10:30:34 PM, you wrote: KH> On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: >> Hello pgsql-sql, >> >> Is anybody know how create field in a new table with data type accuiring >> from a field in other table? >

[SQL] create table and data types

2006-02-14 Thread Maciej Piekielniak
Hello pgsql-sql, Is anybody know how create field in a new table with data type accuiring from a field in other table? For example: create table new_table ( name other_table.name%TYPE ); -- Best regards, Maciej mailto:[EMAIL PROTECTED] ---