Re: [SQL] Unable to create function which takes no arguments

2008-06-09 Thread Mark Roberts
IIRC, current_timestamp doesn't require parens. You could try something like this: select extract(epoch from current_timestamp)::int4 as result; -Mark On Mon, 2008-06-09 at 12:05 -0400, Michael Eshom wrote: > I am a project manager for a popular forum system. We are adding > support for PostgreS

Re: [SQL] Unable to create function which takes no arguments

2008-06-09 Thread hubert depesz lubaczewski
On Mon, Jun 09, 2008 at 12:05:52PM -0400, Michael Eshom wrote: > I am trying to create a "UNIX_TIMESTAMP()" function in PostgreSQL, which > will return the current timestamp. However, whenever I try to add this > function in phpPgAdmin, it says 'Syntax error at or near ")" at > character 28'. y

Re: [SQL] Unable to create function which takes no arguments

2008-06-09 Thread Pavel Stehule
Hello current_timestamp is some more than less constant :) try, please postgres=# select extract(epoch from current_timestamp); date_part -- 1213030028.17068 (1 row) or postgres=# select extract(epoch from current_timestamp)::int; date_part 1213030113 (1 row)

[SQL] Unable to create function which takes no arguments

2008-06-09 Thread Michael Eshom
I am a project manager for a popular forum system. We are adding support for PostgreSQL in the next version (which is currently in beta), and have added several PostgreSQL functions to emulate MySQL functions of the same name. I am trying to create a "UNIX_TIMESTAMP()" function in PostgreSQL,

Re: [SQL] Parallel updates on multiple cores

2008-06-09 Thread Simon Riggs
On Mon, 2008-06-09 at 01:29 -0700, Andrei wrote: > The function above updates the rows between the ids start_id and > end_id. > I have a quad core procesor so i run two separate connections to the > database: select populate_test_data(5000,1) and another select > populate_test_data(5000,2). In thi

Re: [SQL] Parallel updates on multiple cores

2008-06-09 Thread Shane Ambler
Andrei wrote: The function above updates the rows between the ids start_id and end_id. I have a quad core procesor so i run two separate connections to the database: select populate_test_data(5000,1) and another select populate_test_data(5000,2). In this case each function runs on one core doing

[SQL] Parallel updates on multiple cores

2008-06-09 Thread Andrei
I have the following case: a simple table drop table test_data; create table test_data ( id bigserial not null primary key, content varchar(50), processed varchar(1) ); My function doing the inserts CREATE OR REPLACE FUNCTION populate_test_data(IN nr_records BIGINT, IN proc_nr BIGINT) RETURNS i