> test=# select c,(ff).* from (select bar.*,get_a_foo(c) as ff from
bar) b;
> c | a | b
> ---+---+---
> 1 | 1 | 2
> (1 row)
>
>
Tanks! that works great! It managed to get it even a bit more
simplified:
select bar.*, (get_a_foo(c)).* from bar;
> Not amazingly elegant, but it works. Note that you
Postgresql supports records in the where clause i.e. you can compare
multiple columns simultaneously:
> test=# delete from change where id || ':' || datum not in (select id ||
':' || max(datum) from change group by id order by 1);
could therefore be rewritten to:
delete from change where (id, da
> test=# select c,(ff).* from (select bar.*,get_a_foo(c) as ff from bar) b;
> c | a | b
> ---+---+---
> 1 | 1 | 2
> (1 row)
>
Tanks! that works great! It managed to get it even a bit more simplified:
select bar.*, (get_a_foo(c)).* from bar;
> Not amazingly elegant, but it works. Note that you
Dear all,
I have two questions: fist of all, is there any
function in pg like oracle's rownum?
secondly, I wonder how it is possible to let a
function return a dataset with different columns instead of a single,
complex, one.
create table foo (a int, b int);
insert into foo (a,b) valu
Dear all,
I have written a function that returns a set. This set is of a type I
made, containing multiple attributes.
create type my_type as (col1 int, col2 int)
Something likes this works:
select col1 from my_pg_func('hello');
But how can I do something like this:
select my_pg_func(t
Dear Martijn,
The problem with your solution is that the script is meant to process a
log-file real-time.
Therefore the insert should be done immediately, however it is the same
statement over and over agian, just with different parameters i.e. an ideal
case fore PREPARE.
Yours,
Aarjan Langereis
Dear all,
I've written a bash script that looks like the one below:
#!/bin/bash
DBuser='root'
DBname='test'
psql -q --username=$DBuser --dbname=$DBname -c "prepare test_statement
(integer) as insert into tbl_test (col_test) values (\\$1)";
tail -f /root/testfile | while read a;
do
gin
insert into test_que (row_id) values (new.id);
return new;
end;
'
language plpgsql;
create trigger trigger_test
before insert
on test1
for each row
execute procedure trg_test();
Yours,
Aarjan
- Original Message -
From: "Chris Kratz" <[EMAIL PROTECTED]&g
Dear Chris,
What about this:
insert into test1
select id, data from test2
where id, data not in (select id, data from test1);
of which one would expect the same results...
Yours,
Aarjan
Ps. notice that you are inserting data into a serial column (in your
examples as well), as far as I
Difference in indexes
>
> ""A.j. Langereis"" <[EMAIL PROTECTED]> wrote
> >
> > "Bitmap Heap Scan on hosts (cost=2.07..11.34 rows=21 width=59) (actual
> > time=0.175..0.287 rows=21 loops=1)"
> > " Recheck Cond: ((hostname)::text
ame on hosts (cost=0.00..37.28 rows=21
width=59) (actual time=0.068..0.281 rows=21 loops=1)"
" Index Cond: ((hostname)::text = 'Fabian'::text)"
"Total runtime: 0.492 ms"
Yours,
Aarjan
- Original Message -
From: "Qingqing Zhou" <[E
Dear all,
I'm using a PostgreSQL 8.1.0 dabase on a Fedora
Core 3 machine here. In this table there is a table hosts:
CREATE TABLE hosts( hostid int4 NOT
NULL DEFAULT nextval('hosts_hostid_seq'::regclass), hostip cidr NOT
NULL, hostname varchar(50), lastseen timestamp DEFAULT
'1970-01
First of all: "TIP 2: Don't 'kill -9' the postmaster"
On topic: What do you mean with "locked"? Is it using 100% CPU? Or does it
give any error messages? If so, what are they?
If there is a deadlock situation, Postmaster should detect it and will then
cancel the query.
Yours,
Aarjan
- Origin
13 matches
Mail list logo