Re: [GENERAL] datestyle formatting

2005-01-11 Thread Michael Fuhr
On Tue, Jan 11, 2005 at 12:03:16AM -0600, [EMAIL PROTECTED] wrote: I need to know the day of the week for a schedule rotation algorithm i'm working on. Others have already replied to this part. I've switched the datestyle format in the .conf file and used the set to command, but my output

[GENERAL] Private or publice function

2005-01-11 Thread Nirmalya Lahiri
Hi, How can I create a publice or private function? Nirmalya Lahiri __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 ---(end of

[GENERAL] PL/Perl

2005-01-11 Thread ON.KG
Hi All! I'm trying in 'plperl' forking the processes by 'fork' function, but receiving this message Warning: pg_exec(): Query failed: ERROR: creation of function failed: 'fork' trapped by operation mask at (eval 2) line 11. Does it mean, that in 'plperl' I can't use 'fork' function???

Re: [GENERAL] Private or publice function

2005-01-11 Thread Richard Huxton
Nirmalya Lahiri wrote: Hi, How can I create a publice or private function? I'm not sure the concept makes sense in PostgreSQL. Can you explain what you're trying to achieve? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: you

Re: [GENERAL] PL/Perl

2005-01-11 Thread Ragnar HafstaĆ°
On Tue, 2005-01-11 at 14:59 +0300, ON.KG wrote: I'm trying in 'plperl' forking the processes by 'fork' function, but receiving this message Warning: pg_exec(): Query failed: ERROR: creation of function failed: 'fork' trapped by operation mask at (eval 2) line 11. Does it mean, that in

Re: [GENERAL] PL/Perl

2005-01-11 Thread Richard Huxton
ON.KG wrote: Hi All! I'm trying in 'plperl' forking the processes by 'fork' function, but receiving this message Warning: pg_exec(): Query failed: ERROR: creation of function failed: 'fork' trapped by operation mask at (eval 2) line 11. Does it mean, that in 'plperl' I can't use 'fork' function???

[GENERAL] views in 8.0

2005-01-11 Thread Jason Tesser
Can you insert and update data in views in 8.0 I know you cannot in 7.4. I am asking because I want to make new structure for my backend but for legacy apps I need to keep the old sturcture also. I was hoping to use views to accomplish this by making the new structure and give the old apps

Re: [GENERAL] to_char(0,'9999.99') - .00

2005-01-11 Thread Phil Endecott
I asked: to_char(0,'.99') returns .00 rather than 0.00. Dave Smith replied: to_char(0,'9990.00') ? Thanks Dave, that's embarrassingly obvious... I note that the examples in the documentation don't have a 0 before the decimal point, e.g. this one to_char(148.5, 'FM999.990')

Re: [GENERAL] views in 8.0

2005-01-11 Thread Peter Eisentraut
Am Dienstag, 11. Januar 2005 13:43 schrieb Jason Tesser: Can you insert and update data in views in 8.0 I know you cannot in 7.4. Views not updatable in 7.4 or in 8.0. You need to write your own update rules. Nothing has changed in that regard. -- Peter Eisentraut

Re: [GENERAL] Simulating WAL on separate disks

2005-01-11 Thread Alex Turner
I would also suggest in addition to the other folks comments that you benchmark the 4 disks in RAID 10 in addition to RAID 5. RAID 5 typicaly has poor write performance because it must read the stripe, modify, calculate new parity and write, and if you are doing alot of inserts, you may find that

[GENERAL] Interval Question

2005-01-11 Thread Terry Lee Tucker
Greetings: I am working on a function which returns an interval value. The work of the function is to calculate the difference between the appointment timestamp and and the current timestamp, represented as an interval, and the the time required to travel from point A to B, represented as an

Re: [GENERAL] Interval Question

2005-01-11 Thread Timothy Perrigo
Can you post the code for the function you are having trouble with? The following psql query works as expected (returns a negative interval): select '3 days 4 hours 17 mins'::interval - '3 days 6 hours 17 mins'::interval; ?column? --- -02:00:00 Inserting the difference into a table

Re: [GENERAL] Interval Question

2005-01-11 Thread Stephan Szabo
On Tue, 11 Jan 2005, Terry Lee Tucker wrote: As you can see, this truck is going to be 2 hours late. The return value I'm looking for is the difference between Appt. Interval and Travel Interval, as in: return (appt_interval - travel_interval). This value will be stored in a column of type

Re: [GENERAL] Interval Question

2005-01-11 Thread Tom Lane
Terry Lee Tucker [EMAIL PROTECTED] writes: I thought that subtracting the larger interval from the small would return this but it is always the absolute value. Eh? regression=# set DateStyle TO ISO; SET regression=# select '@ 3 days 4 hours 17 mins'::interval - regression-# '@ 3 days 6 hours

Re: [GENERAL] PostgreSQL 8 on windows very slow

2005-01-11 Thread Daniel Schuchardt
lol wrote: I have tried RC4, but there's no differences My results using my configuration are : MySQL 4 is 6 times faster than pgSQL Firebird 1.5 is 3 times faster than pgSQL Are these results coherent ? May be the problem comes more from ZeosLib than pgSQL8 what zeoslib do you use? 6.X? thay are

[GENERAL] problems with 8.0 Rc4

2005-01-11 Thread Peter Childs
I've been trying to check that my current application working on postgres 7.4 will work with 8.0. I've not checked the application yet but I'm getting a few error messages, I don't understand and are worring me slightly. I need to get 8.0 to work because I'm keen to start using the new

Re: [GENERAL] Interval Question

2005-01-11 Thread Terry Lee Tucker
Is is a bare bones copy of the function. The travel time is hard coded for the example. By the way, I'm on version 7.4. On Tuesday 11 January 2005 10:10 am, Timothy Perrigo saith: Can you post the code for the function you are having trouble with? The following psql query works as expected

Re: [GENERAL] Interval Question

2005-01-11 Thread Terry Lee Tucker
Check this out: rnd=# show DateStyle; DateStyle --- SQL, MDY (1 row) rnd=# select interval '@ 3 days 4 hours 17 mins'::interval - '@ 3 days 6 hours 17 mins'::interval; ?column? --- @ 2 hours (1 row) And... rnd=# set DateStyle to postgres; SET rnd=# select interval '@ 3 days

Re: [GENERAL] Interval Question

2005-01-11 Thread Terry Lee Tucker
Apparently, if DateStyle is set to Sql, it always returns the absolute value. Is this due to some Sql standard or is it a bug? On Tuesday 11 January 2005 10:19 am, Tom Lane saith: Terry Lee Tucker [EMAIL PROTECTED] writes: I thought that subtracting the larger interval from the small would

Re: [GENERAL] Limiting USAGE to only certain objects within a schema

2005-01-11 Thread Bruno Wolff III
On Mon, Jan 10, 2005 at 14:40:46 -0800, Chris [EMAIL PROTECTED] wrote: Basically what I want is to limit a user to not being able to view certain tables within a schema, in this case the public schema. Say we have 300 tables in a database but a particular user only needs access to 3 of

Re: [GENERAL] PL/Perl

2005-01-11 Thread Joshua D. Drake
ON.KG wrote: Hi All! I'm trying in 'plperl' forking the processes by 'fork' function, but receiving this message Have you tried performing this with plperlU? Sincerely, Joshua D. Drake Warning: pg_exec(): Query failed: ERROR: creation of function failed: 'fork' trapped by operation mask at

Re: [GENERAL] Limiting USAGE to only certain objects within a schema

2005-01-11 Thread Chris
What do you mean by view other tables? You can see metadata for tables in the catalog tables and you can't block access to those without causing problems. That is what I meant, viewing the metadata. I didn't think there was a way to block that without causing problems, but thought i would

Re: [GENERAL] Interval Question

2005-01-11 Thread Terry Lee Tucker
Thanks for the answers. By the way, I'm not trying to parse the textual output to discover if it is netative. Apparently, I failed to communicate my purpose properly. I just want to return the value, regardless of netative or positive, to the user and store it in a column of type interval. I

Re: [GENERAL] Private or publice function

2005-01-11 Thread Richard Huxton
Nirmalya Lahiri wrote: Thanks Richard, for your reply. Now I am explaining you what I want. Let I have 4 functions..function_1(),function_2(),function_3(),function_4(). [snip] Now after creating these functions, I can easily call every function from psql prompt. But I want to encapsulate

Re: [GENERAL] Private or publice function

2005-01-11 Thread Nirmalya Lahiri
Thanks Richard, for your reply. Now I am explaining you what I want. Let I have 4 functions..function_1(),function_2(),function_3(),function_4(). create or replace function function_1() returns numeric as ' begin create or replace function function_2() returns numeric as '' begin

Re: [GENERAL] Interval Question

2005-01-11 Thread Tom Lane
Terry Lee Tucker [EMAIL PROTECTED] writes: Apparently, if DateStyle is set to Sql, it always returns the absolute value. Is this due to some Sql standard or is it a bug? It's a bug in interval_out. Looks like it gets it wrong for GERMAN style too. Surprising no one noticed before. (In any

Re: [GENERAL] Interval Question

2005-01-11 Thread Geoffrey
Tom Lane wrote: Terry Lee Tucker [EMAIL PROTECTED] writes: Apparently, if DateStyle is set to Sql, it always returns the absolute value. Is this due to some Sql standard or is it a bug? It's a bug in interval_out. Looks like it gets it wrong for GERMAN style too. Surprising no one noticed

Re: [GENERAL] Interval Question

2005-01-11 Thread Tom Lane
Geoffrey [EMAIL PROTECTED] writes: Tom Lane wrote: It's a bug in interval_out. Looks like it gets it wrong for GERMAN style too. Surprising no one noticed before. Any idea when I might be able to put my hands on Red Hat 3 rpm versions that include this fix? [ shrug... ] Whenever there

Re: [GENERAL] Private or publice function

2005-01-11 Thread Bruno Wolff III
On Tue, Jan 11, 2005 at 18:36:17 +, Richard Huxton dev@archonet.com wrote: Nirmalya Lahiri wrote: Thanks Richard, for your reply. Now I am explaining you what I want. Let I have 4 functions..function_1(),function_2(),function_3(),function_4(). [snip] Now after creating these

Re: [GENERAL] problems with 8.0 Rc4

2005-01-11 Thread Bruno Wolff III
On Tue, Jan 11, 2005 at 15:40:07 +, Peter Childs [EMAIL PROTECTED] wrote: I thought pg_autovaccum was going to be built into 8.0 or was that only a rumor. Due to some unfortunate things it was not ready by the beta cutoff, so it is staying in contrib for the 8.0 release.

[GENERAL] Modifying search_path in a stored procedure

2005-01-11 Thread Eric Brown
I know I can SET the schema search_path in a stored procedure, but is there any way to retrieve it first so that I can get the current value and manipulate that rather than just replace it? I've got two sets of data and two sets of functions in 4 respective schemas. I want to select one set of

Re: [GENERAL] Modifying search_path in a stored procedure

2005-01-11 Thread Michael Fuhr
On Tue, Jan 11, 2005 at 01:19:55PM -0800, Eric Brown wrote: I know I can SET the schema search_path in a stored procedure, but is there any way to retrieve it first so that I can get the current value and manipulate that rather than just replace it? See the current_setting() and

Re: [GENERAL] Modifying search_path in a stored procedure

2005-01-11 Thread Tom Lane
Eric Brown [EMAIL PROTECTED] writes: I know I can SET the schema search_path in a stored procedure, but is there any way to retrieve it first so that I can get the current value and manipulate that rather than just replace it? current_setting() would produce the value you want to give back

[GENERAL] Running a void function in psql

2005-01-11 Thread Eric Brown
I run 'psql -f mycreatedb.sql' to setup things for my program. It has to run a few stored procedures after they're created. However, I do this by 'SELECT f(...);'. When I do this though, it prints out a bunch of rubbish like: f -- (1 row) How do I get rid of this rubbish? I just want to see

[GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Roman Neuhauser
Hello, what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as timestamp) and the documentation says abstime shouldn't be used, and may disappear. What should I use instead? -- FreeBSD 4.10-STABLE 12:01AM up 15:39, 7

Re: [GENERAL] Running a void function in psql

2005-01-11 Thread Tom Lane
Eric Brown [EMAIL PROTECTED] writes: I run 'psql -f mycreatedb.sql' to setup things for my program. It has to run a few stored procedures after they're created. However, I do this by 'SELECT f(...);'. When I do this though, it prints out a bunch of rubbish like: f -- (1 row) How do

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Tom Lane
Roman Neuhauser [EMAIL PROTECTED] writes: what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as timestamp) and the documentation says abstime shouldn't be used, and may disappear. What should I use instead? The

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Michael Glaesemann
On Jan 12, 2005, at 8:35, Tom Lane wrote: The recommended locution is SELECT TIMESTAMP WITH TIME ZONE 'epoch' + x * INTERVAL '1 second'; Of course you can wrap this up in a function if you prefer (not sure why we haven't done so already). It's in the queue for 8.1.

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-01-11 18:35:18 -0500: Roman Neuhauser [EMAIL PROTECTED] writes: what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as timestamp) and the documentation says abstime shouldn't be used,

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Tom Lane
Roman Neuhauser [EMAIL PROTECTED] writes: The recommended locution is SELECT TIMESTAMP WITH TIME ZONE 'epoch' + x * INTERVAL '1 second'; Have I missed this in the manual? The 8.0 docs mention this in the discussion of extract(epoch), but I'm not sure if it was there before. It's been

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread David Fetter
On Tue, Jan 11, 2005 at 06:35:18PM -0500, Tom Lane wrote: Roman Neuhauser [EMAIL PROTECTED] writes: what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as timestamp) and the documentation says abstime shouldn't

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Tom Lane
David Fetter [EMAIL PROTECTED] writes: The recommended locution is SELECT TIMESTAMP WITH TIME ZONE 'epoch' + x * INTERVAL '1 second'; I think this should read: SELECT TIMESTAMP WITH TIME ZONE 'epoch' AT TIME ZONE 'UTC' + x * INTERVAL '1 second'; /*

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-01-11 19:31:19 -0500: Roman Neuhauser [EMAIL PROTECTED] writes: The recommended locution is SELECT TIMESTAMP WITH TIME ZONE 'epoch' + x * INTERVAL '1 second'; Have I missed this in the manual? The 8.0 docs mention this in the discussion of

Re: [GENERAL] int4 - unix timestamp - sql timestamp; abstime?

2005-01-11 Thread David Fetter
On Tue, Jan 11, 2005 at 07:44:46PM -0500, Tom Lane wrote: David Fetter [EMAIL PROTECTED] writes: The recommended locution is SELECT TIMESTAMP WITH TIME ZONE 'epoch' + x * INTERVAL '1 second'; I think this should read: SELECT TIMESTAMP WITH TIME ZONE 'epoch' AT TIME ZONE 'UTC' + x *

[GENERAL] Bug in pg_dump in 7.4.6?

2005-01-11 Thread Greg Stark
I regularly do a pg_dump -s and store the file in CVS. Normally I briefly look over the diff before committing so I can describe the changes. This latest time I observed a strange behaviour. 7.4.6 pg_dump seems to be inserting a lot more SET SESSION AUTHORIZATION lines than previously. Before

[GENERAL] plpgsql/rule question

2005-01-11 Thread Ed L.
Is it possible to tell if a column in a NEW record in a plpgsql function was explicitly specified as NULL or simply left out altogether? For example, if I have the following table: create table foo(id serial, msg varchar) Is it possible to distinguish within plpgsql between these two

Re: [GENERAL] plpgsql/rule question

2005-01-11 Thread Tom Lane
Ed L. [EMAIL PROTECTED] writes: For example, if I have the following table: create table foo(id serial, msg varchar) Is it possible to distinguish within plpgsql between these two queries? insert into foo (msg) values ('Hello') insert into foo (id, msg) values (NULL,

Re: [GENERAL] Bug in pg_dump in 7.4.6?

2005-01-11 Thread Tom Lane
Greg Stark [EMAIL PROTECTED] writes: 7.4.6 pg_dump seems to be inserting a lot more SET SESSION AUTHORIZATION lines than previously. By previously do you mean 7.4.5 or thereabouts? I can't recall any late-7.4.* changes that might affect this. pg_dump is supposed to optimize away redundant SET

Re: [GENERAL] plpgsql/rule question

2005-01-11 Thread Ed L.
On Tuesday January 11 2005 8:40, Tom Lane wrote: Is it possible to distinguish within plpgsql between these two queries? insert into foo (msg) values ('Hello') insert into foo (id, msg) values (NULL, 'Hello') Well, yes, because the default value in the former case will not be

Re: [GENERAL] plpgsql/rule question

2005-01-11 Thread Ed L.
On Tuesday January 11 2005 8:58, Tom Lane wrote: Ed L. [EMAIL PROTECTED] writes: The reason I ask is because I'd like to allow any explicitly specified values for the view insert, including NULL, to be passed through to the table insert and override the column defaults. Possibly you can

Re: [GENERAL] plpgsql/rule question

2005-01-11 Thread Tom Lane
Ed L. [EMAIL PROTECTED] writes: The reason I ask is because I'd like to allow any explicitly specified values for the view insert, including NULL, to be passed through to the table insert and override the column defaults. Possibly you can solve your problem by attaching the defaults to the

Re: [GENERAL] plpgsql/rule question

2005-01-11 Thread Michael Fuhr
On Tue, Jan 11, 2005 at 07:13:25PM -0700, Ed L. wrote: Is it possible to tell if a column in a NEW record in a plpgsql function was explicitly specified as NULL or simply left out altogether? Why would you want to? What problem are you trying to solve? -- Michael Fuhr

Re: [GENERAL] Bug in pg_dump in 7.4.6?

2005-01-11 Thread Greg Stark
Tom Lane [EMAIL PROTECTED] writes: Greg Stark [EMAIL PROTECTED] writes: 7.4.6 pg_dump seems to be inserting a lot more SET SESSION AUTHORIZATION lines than previously. By previously do you mean 7.4.5 or thereabouts? I think I went from 7.4.2 to 7.4.6. But I'm having trouble finding any