Re: [GENERAL] circular stderr logging - truncation issue

2008-09-26 Thread vk
note, I tried both with "#log_rotation_size = 10MB " - commented/default, and then enabled it as per documentation page both having similar result - no truncation. there is example on that documentation page that suggests that both size and time based rotation could be possible while truncation

[GENERAL] circular stderr logging - truncation issue

2008-09-26 Thread vk
Hello everyone! I'm trying to implement circular stderr logging: postgresql 8.3.4 compiled from src fedora 6 x86_64, Intel Core 2 Duo, 2GB RAM /usr/local/pgsql/ partition mounted noatime based on the following document managing circular/logging should be possible: http://www.postgresql.org/docs

Re: [GENERAL] Using a User-Def function in a query

2008-09-26 Thread Ralph Smith
On Sep 23, 2008, at 7:50 PM, Tom Lane wrote: Ralph Smith <[EMAIL PROTECTED]> writes: I've written several user-defined functions (UDFs) for converting dates to unix time, every which way. ... but when I try to use the function in a query # select count(distinct username) from stats where ev

Re: [GENERAL] Using a User-Def function in a query

2008-09-26 Thread Ralph Smith
Ralph Smith <[EMAIL PROTECTED]> writes: I've written several user-defined functions (UDFs) for converting dates to unix time, every which way. ... but when I try to use the function in a query # select count(distinct username) from stats where eventtime > dtu_dmony('22 Sep 2008') ; it never

Re: [GENERAL] Rounding of floating point in text dumps?

2008-09-26 Thread Tom Lane
Chris Browne <[EMAIL PROTECTED]> writes: > In the interests of personal laziness ;-), I'll throw the question to > this list: how may we expect the imprecisions of FP affect text-based > database dumps, if at all? If the platform's float I/O routines conform fully to spec, you can expect FP values

[GENERAL] Rounding of floating point in text dumps?

2008-09-26 Thread Chris Browne
A question came up on the Slony-I list (quite a while ago, but that's another story!) as to the handling of floating point values. The user is concerned about whether FP values are faithfully replicated. I commented that the issue will be identical to that of the handling of data in pg_dump; if S

Re: [GENERAL] Is there any way to reliably influence WHERE predicate evaluation ordering?

2008-09-26 Thread Tom Lane
Decibel! <[EMAIL PROTECTED]> writes: > On Sep 26, 2008, at 4:19 PM, Tom Lane wrote: >> Use a trigger. > The problem is that the rules are sitting on a view, Oh, I overlooked that bit :-( > This is 8.1; do later versions have the ability to put triggers on > views? No, we still haven't figured

Re: [GENERAL] Is there any way to reliably influence WHERE predicate evaluation ordering?

2008-09-26 Thread Decibel!
On Sep 26, 2008, at 4:19 PM, Tom Lane wrote: Decibel! <[EMAIL PROTECTED]> writes: Does anyone have any ideas on a clean and reliable way to do this? Use a trigger. The problem is that the rules are sitting on a view, not a real table. And the view has columns that don't exist in both table

Re: [GENERAL] Need Some Explanation of an EXPLAIN

2008-09-26 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > On Fri, Sep 26, 2008 at 12:13 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: >> 2.) How can I make this update faster? > Get a faster server? Increasing work_mem might help. If the hashtable size estimate is right, you'd need something like 100MB to be su

Re: [GENERAL] Is there any way to reliably influence WHERE predicate evaluation ordering?

2008-09-26 Thread Tom Lane
Decibel! <[EMAIL PROTECTED]> writes: > Does anyone have any ideas on a clean and reliable way to do this? Use a trigger. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.

Re: [GENERAL] dynamic sql in PL-Pgsql ?

2008-09-26 Thread Raymond O'Donnell
On 26/09/2008 21:19, Gauthier, Dave wrote: > As you can see, the select statement needs to be dynamic in that the > column name is stored in a variable. > > > Can this be done? http://www.postgresql.org/docs/8.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

[GENERAL] dynamic sql in PL-Pgsql ?

2008-09-26 Thread Gauthier, Dave
Hi: I want to do something like this. create or replace function foo(varchar, varchar) returns integer as $$ declare user_attrib alias for $1; attrib_valalias for $2; rec record; begin for rec in select name from people_table where user_attrib = attrib

[GENERAL] Is there any way to reliably influence WHERE predicate evaluation ordering?

2008-09-26 Thread Decibel!
I've been working with some views that UNION ALL two tables and are also updatable. On field in the view ('committed') simply indicates what table a row came from. I don't want people to try and update that field and think it'll take effect, so I have an assert function: CREATE OR REPLACE R

Re: [GENERAL] Need Some Explanation of an EXPLAIN

2008-09-26 Thread Scott Marlowe
On Fri, Sep 26, 2008 at 12:13 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: > I'm trying to update a field in a table that has about 5 millin records with > a table that has about 3.5 million records. I've created indexes for th a > joined columns, but PostgreSQL 8.1 doesn't seem to want to use them.

[GENERAL] Need Some Explanation of an EXPLAIN

2008-09-26 Thread Bill Thoen
I'm trying to update a field in a table that has about 5 millin records with a table that has about 3.5 million records. I've created indexes for th a joined columns, but PostgreSQL 8.1 doesn't seem to want to use them. This makes for a very slow update. Below are descriptions of the two tabl

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Dianne Yumul
Would an EAV model work? I'm thinking something like . For example: formA,ckbox1,true formA,input1,initial value formB,textarea1,enter your long comment here You could easily extend this to , or normalize it as you see fit. This would work great too. If we go this route, we'll keep it simpl

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Reece Hart
On Fri, 2008-09-26 at 09:23 -0700, Dianne Yumul wrote: > If the structure of each report did not differ this would work great > but unfortunately it does. Diane- Would an EAV model work? I'm thinking something like . For example: formA,ckbox1,true formA,input1,initial value formB,textarea1,en

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Martin Gainty
I would suggest trying to keep architecture simple with a one-to-one correspondence between Architecture classes and the class attributes and DB Tables and the DB table's columns This will come in handy when and if you want to look at ORM tools to persist the class attributes to DB tables and c

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Dianne Yumul
which webserver does your client want to implement? Apache, sorry I forgot to mention. If JSLibrary = Dojo I would look at JSON (JavaScript Object Notation language) I would serialize to JSON instead of XML. http://www.aurore.net/projects/php-json/ A simple json_encode($_POST) might do th

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Dianne Yumul
First, I want to thank you for your help. You have made great points and I just want to respond to some of your questions. My first thought is that if you use a combined "info" field, you'll lose the ability to easily do any kind of meaningful data analysis based on which boxes are checked. I

Re: [GENERAL] types for C function composites

2008-09-26 Thread Tom Lane
"Merlin Moncure" <[EMAIL PROTECTED]> writes: > In a backend C function, is there any way to get the type (Probably > via TupleDesc) of a passed in composite type? Sure. The canonical example is record_out(). regards, tom lane -- Sent via pgsql-general mailing list (pgs

Re: [GENERAL] Largest PostgreSQL 8.x DB someone is running?

2008-09-26 Thread Michelle Konzack
Am 2008-09-21 22:14:56, schrieb Keaton Adams: > What is the the largest PostgreSQL 8.x database that is running in a > production environment that you are aware of? We top out at roughly > 400 GB but have a need for a new project to go much, much larger (in > the several TB range). I am attemptin

[GENERAL] types for C function composites

2008-09-26 Thread Merlin Moncure
In a backend C function, is there any way to get the type (Probably via TupleDesc) of a passed in composite type? I'm trying to build a generic function that does not assume the types of the composite fields...I take it this might not be possible. merlin -- Sent via pgsql-general mailing list

Re: [GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Raymond O'Donnell
On 26/09/2008 14:40, Stephan Szabo wrote: > Actually, I think the function probably isn't at fault here, string > literals should be surrounded with ' not ". Yes, that's true. In addition to that, however, if you look at your SELECT statement you're selecting all users in the table; the argument

Re: [GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Stephan Szabo
On Fri, 26 Sep 2008, Chris Baechle wrote: > When I try to run it with: > select user_checkCredentials("asdf"); Actually, I think the function probably isn't at fault here, string literals should be surrounded with ' not ". -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Raymond O'Donnell
On 26/09/2008 14:52, Raymond O'Donnell wrote: > begin > select into permission permtype from users > where uid = username; > return permtype; > end Whoops - that should be return permission; That's enough good advice from me for today :-) Ray. --

Re: [GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Raymond O'Donnell
On 26/09/2008 14:41, Raymond O'Donnell wrote: > CREATE OR REPLACE FUNCTION user_checkCredentials(character varying) > RETURNS character varying AS > $BODY$ > DECLARE > username ALIAS FOR $1; I meant to say too that in pl/pgsql, you can use argument names directly (unless you're using a *reall

Re: [GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Tom Lane
"Chris Baechle" <[EMAIL PROTECTED]> writes: > When I try to run it with: > select user_checkCredentials("asdf"); > I get the error: > ERROR: column "asdf" does not exist You're confused about single quotes (literal strings) versus double quotes (identifiers). regards, to

Re: [GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Raymond O'Donnell
On 26/09/2008 14:35, Chris Baechle wrote: > CREATE OR REPLACE FUNCTION user_checkCredentials(character varying) > RETURNS character varying AS > $BODY$ > DECLARE > username ALIAS FOR $1; > permission record; > BEGIN > select into permission permtype from users; > RETURN permissio

Re: [GENERAL] ]OT] Database structure question

2008-09-26 Thread Scott Marlowe
On Fri, Sep 26, 2008 at 12:46 AM, Joey K. <[EMAIL PROTECTED]> wrote: After reading all your requirements, I have a question, will you be hosting the app yourself, or will your customers be hosting it? If you are, then the security issues you bring up are inconsequential, as it will be code you co

[GENERAL] PL/PGSQL - character varying as function argument

2008-09-26 Thread Chris Baechle
I'm fairly new at PL/PGSQL and I'm trying to create a login function. I want to pass the username and password to the function and return the permission type that user has. Here's a shortened version of the function with just the part giving me problems. CREATE OR REPLACE FUNCTION user_checkCrede

Re: [GENERAL] Dynamically created cursors vanish in PLPgSQL

2008-09-26 Thread Pavel Stehule
Hello 2008/9/26 Reg Me Please <[EMAIL PROTECTED]>: > Nice suggestion. > > In the meanwhile I've found a "workaround" that works for me (unless there's a > hidden pitfall): > > CREATE OR REPLACE FUNCTION f_cursor2( query text, out curs refcursor ) > LANGUAGE PLPGSQL STRICT > AS $BODY$ > DECLARE >

Re: [GENERAL] Stroring html form settings

2008-09-26 Thread Marcus Engene
Dianne Yumul wrote: Hello, I have some html forms that I save the settings into the database, things like which item was selected in the menu and if a checkbox was checked. The table looks like this: user_id | report_id | info -+---+-

Re: [GENERAL] Dynamically created cursors vanish in PLPgSQL

2008-09-26 Thread Reg Me Please
Nice suggestion. In the meanwhile I've found a "workaround" that works for me (unless there's a hidden pitfall): CREATE OR REPLACE FUNCTION f_cursor2( query text, out curs refcursor ) LANGUAGE PLPGSQL STRICT AS $BODY$ DECLARE   c refcursor; BEGIN   c := 'cursor_'||nextval( 's_cursors' ); EXECU

Re: [GENERAL] on duplicate key

2008-09-26 Thread A B
> Here is the appropriate documentation link, where they have an example: > http://www.postgresql.org/docs/8.3/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING > > The primary difference is that they use a loop, which is more robust. In > theory, if you delete the record between when t