Re: [GENERAL] querying the age of a row

2007-06-07 Thread codeWarrior
Interesting issue -- I have usually solved this by adding a specific field to each table with a default timestamp of NOW()... When you: CREATE TABLE tbl ( blah... blah create_dt TIMESTAMP NOT NULL DEFAULT NOW() ); each and every record now has a timestamp of exactly when th

Re: [GENERAL] [PG7.4] Using the data from temp table within a function

2005-09-28 Thread codeWarrior
"Mario Splivalo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've learned that one can't use temporary tables within the function > unless > EXECUTE'd the SELECTS from that temp table. > > So, I have a function like this: > > CREATE FUNCTION Foo1(int4, int4) RETURNS SETOF myType

Re: [GENERAL] query execution

2005-10-05 Thread codeWarrior
in your postgresql.conf file near the bottom you need to enable statement logging -- set log_statement = 'all' and then you can tail -f /var/logs/postgresql/postgresql.log or tail -f wherever your postgres log is... from the 'Nix command line "Matthew Peter" <[EMAIL PROTECTED]> wrote in messa

Re: [GENERAL] user privilages for executing pg_autovacuum?

2005-10-12 Thread codeWarrior
I run pg_autovacuum as user postgres: owner of the database processes and an unprivileged user (nologin) ""Zlatko Matiæ"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] For pg_dump minimum privilages is to have select right on tables. For vacuumdb, one must be owner of tables or

Re: [GENERAL] Reverse engineering SW

2005-10-19 Thread codeWarrior
You can also reverse engineer a postgreSQL RDBMS using an ODBC driver and MicroSloth's Visio. "Bruno Cochofel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi you all, > > His there any SW that can do reverse engineering on postgreSQL > databases? I need something that can

Re: [GENERAL] is there a function which elminates spaces?

2005-10-24 Thread codeWarrior
SELECT trim(trailing ' ' from city_name) AS city_name FROM sys_cities; You might consider reading the manual as there are a multitude of string manipulation functions built into postgreSQL "Pierre Couderc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In a WHERE clause, I

Re: [GENERAL] pg_dump fails when it gets to table containing bytea

2005-10-27 Thread codeWarrior
Is your table really named "blob" ??? You said it fails when it gets to the table named "blob" not somewhere in the process of dumping the table "blob"... There might be a clue in that... What happens if yo rename the table to something other than an SQL reserverd word ? Although postgreSQL doe

Re: [GENERAL] Data Dictionary generator?

2005-11-03 Thread codeWarrior
SELECT isc.table_name, isc.ordinal_position::integer AS ordinal_position, isc.column_name::character varying AS column_name, isc.column_default::character varying AS column_default, isc.data_type::character varying AS data_type, isc.character_maximum_length::integer AS str_length, C

Re: [GENERAL] Replicating databases

2005-11-03 Thread codeWarrior
It doesnt sound to me like replication is the right answer to this problem... You are setting yourself up to try and defeat one of the major purposes of a database in a client-server system -- namely -- centralized storage. If you add up all the money you are going to spend trying to manage mul

Re: [GENERAL] odbc in postgresql and php

2005-11-08 Thread codeWarrior
ODBC has nothing to do with this -- you compile postgreSQL support directly into PHP when you configure PHP just before the install...   ./Configure --with-postgres --without-mysql     After that -- you need to join a PHP newsgroup for PHP questions     ""Bob Powell"" <[EMAIL PROTECT

Re: [GENERAL] insert on duplicate update?

2005-11-09 Thread codeWarrior
You absolutely should NOT I repeat NOT -- DON'T dink around with the system catalogs in ANY database... If you need to create UDT's then you should follow the proper mechanisms to create your own user-defined types... ""Peter Filipov"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECT

Re: [GENERAL] Most significant digit number formatting

2005-11-17 Thread codeWarrior
If it is a numeric data column -- you probably want to use the "round" function: SELECT round(1200.01, 3); SELECT round(12.009, 2); "Berend Tober" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Say I want to format calculated numeric output to uniformly have a > specific number

Re: [GENERAL] Very slow queries on 8.1

2005-11-17 Thread codeWarrior
What is the data type for "signum" ??? "David Rysdam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm porting an application from Sybase and I've noticed that similar > application functions take 2 to 3 times longer on postgres than they used > to on the same machine running

Re: [GENERAL] Most significant digit number formatting

2005-11-17 Thread codeWarrior
formatting but this will be a string instead of a number... SELECT round(12.0109, 3)::text; Greg... "Berend Tober" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > codeWarrior wrote: > >>If it is a numeric data column -- you probably wan

Re: [GENERAL] Strugging with NEW and OLD records.

2005-11-23 Thread codeWarrior
On top of that... "name" is a postgreSQL internal data type -- essentially -- you need to treat it as if it is an SQL "reserved word" Therefore::I strongly recommend that you name your table something other than "name"... for the same reasons you wouldn't name a table "select" (the example

Re: [GENERAL] Problems compiling from source

2007-01-23 Thread codeWarrior
It sort of looks like you are trying to compile a Windows distro of the source code on a 'Nix box to me... -- Regards, Gregory P. Patnude Vice President - Applications & Innovations Group iDynaTECH, Inc 120 North Pine Street STC - Suite 162 Spokane, WA 99202 (509) 343-3104 [voice] http://www

Re: [GENERAL] Linking a Postgres table on Linux to Ms Access

2007-01-25 Thread codeWarrior
go in the other direction... Convert your table in MS Access to use a pass-through query to the postgreSQL table. Connect yoour MS Access pass through table to postgreSQL using OBBC. Even better: Drop MS Access completely and just use postgreSQL. Access is a totally inferior technology. ""car

Re: [GENERAL] Installation on Web Server

2007-01-26 Thread codeWarrior
In theory -- yes. In practicality -- no -- And yes... yopu are corerct -- postgreSQL needs to be installed PHP. YOu will find this to be the case with ANY dependencies in PHP, including things like jpeg supprt, curl, etc. So this is NOT a postgreSQL problem, not really anyway. This is realy a

Re: [GENERAL] Anyone still using the sql_inheritance parameter?

2007-03-21 Thread codeWarrior
+1; Tom: I regularly use the inheritance features of postgreSQL -- Probably 25% of my schemas rely on it for the techiques I use such as: history tables, recursion tables [parent-child and trees], among others. What is the potential impact for the "ONLY" qualifier ??? None I would expect, as

Re: [GENERAL] insert serial numbers

2006-01-03 Thread codeWarrior
Don't use reserved words for column names. "Albert Vernon Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have two tables, listed as below. I'm inserting values for "text" into >table "two" (which must already exist as "text" values in table "one"). >When I do that, I'

Re: [GENERAL] Recommend IDE for PG Development

2006-01-11 Thread codeWarrior
PGAdmin III ""Gevik"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Could anyone Recommend a nice IDE for debugging and developing code for PG > on Linux or Windows. > > Thanx. > > > > ---(end of broadcast)--- > TIP 6: explain analyz

Re: [GENERAL] Returning SQL statement

2006-01-12 Thread codeWarrior
You might want to consider an inheritance model for this I use it for Sarbanes-Oxley and a viurtual rollback system... http://www.postgresql.org/docs/8.0/interactive/tutorial-inheritance.html "rlee0001" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to write a row-leve

Re: [GENERAL] Insert a default timestamp when nothing given

2006-01-19 Thread codeWarrior
Change your table definition and specify a defeault value for your timestamp column this way -- when nothing is given on insert --> it will populate... CREATE TABLE test ( id serial not null primary key, defaultdate timestamp not null default now() ); "" Martin Pohl"" <[EMAIL PRO

[GENERAL] User-defined types

2006-04-07 Thread codeWarrior
Anyone know of a quick and dirty query that can retrieve the various type definitions ? I am looking to retrieve the schema-equivalent representation of a custom (user-defined) types. ---(end of broadcast)--- TIP 1: if posting/reading through Us

Re: [GENERAL] User-defined types

2006-04-07 Thread codeWarrior
dynatech.com "Tom Lane" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "codeWarrior" <[EMAIL PROTECTED]> writes: >> Anyone know of a quick and dirty query that can retrieve the various type >> definitions ? I am looking to retrieve the sc

Re: [GENERAL] Evaluating client processes vs stored procedures

2006-04-12 Thread codeWarrior
During your process loop -- when / where are the updates committed ? all at the end ? How may rows (approx) are you updating ? FWIW: I think you will probably find that it is NOT the SQL update that is your bottleneck I am inclined to speculate that the performance issue is related to the

Re: [GENERAL] "Hidden" field for each column

2006-04-12 Thread codeWarrior
You can specifiy a "comment" on each field "Don Y" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Is there any way that I can consistently (across all > tables) add a parameter defining "what" each column > "is"? (sorry, crappy grammar and ill-formed question). > > I

Re: [GENERAL] Performance UPDATE/INSERT

2006-04-12 Thread codeWarrior
Turn off your indices on the table... do the inserts... do the updates... rebuild the indices       ""MG"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... Hello,   I have about 100 000 records, which need about 30 minutes to write them with single INSERTs into

Re: [GENERAL] PostgreSQL 8.1 + PHP5.1.x/4.4.2 + Apache 2.0.55/1.3.34 PROBLEM!! PLEASE HELP

2006-04-27 Thread codeWarrior
This is not a postgreSQL issue -- you are having problems with your PHP configuration... <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Help! I was trying to make an installation of PHP 5.1.2 + Apache > 2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I > got PHP to

Re: [GENERAL] selecting column comment

2006-04-27 Thread codeWarrior
>From the system catalogs: SELECT PC.relname, PD.description FROM pg_catalog.pg_description PD, pg_catalog.pg_class PC WHERE PD.objoid = PC.oid AND PD.objsubid = 0 "Ari Kahn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a comments on tables in my database. > > e.g. COMMEN

Re: [GENERAL] selecting column comment

2006-05-01 Thread codeWarrior
FWIW: From the system catalogs: SELECT PC.relname, PD.description FROM pg_catalog.pg_description PD, pg_catalog.pg_class PC WHERE PD.objoid = PC.oid AND PD.objsubid = 0 "Ari Kahn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a comments on tables in my database. > > e.g.

Re: [GENERAL] LDAP authentication

2006-05-26 Thread codeWarrior
May I suggest you take a look at www.openldap.org and the following: http://www.samse.fr/GPL/ldap_pg/HOWTO/ <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I saw many messages about ldap authentication but I´m still not sure if > PostgreSQL can use it? > > Can I use it?

Re: [GENERAL] Restricting access to rows?

2006-05-26 Thread codeWarrior
You are apparently dealing with the downside of co-mingling your clients data... maybe you should seriously consider revising your approach and giving each client either separate databases or separate schema's within a given database -- This is why co-mingling should be avoided... I'd push fo

Re: [GENERAL] strange sum behaviour

2006-08-29 Thread codeWarrior
As an alternative -- you could do an inline type cast SELECT SUM(amount)::numeric(10, 2) FROM acc_trans WHERE trans_id=19721 AND chart_id=10019; "Karen Hill" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Andrew Baerg" wrote: >> Hi, >> >> I am getting strange results

Re: [GENERAL] PLPERL Function very Slow

2006-08-30 Thread codeWarrior
1 -- Drop your indexes on the table to be inserted into. 2 -- Execute a BEGIN transaction 3 -- Execute your inserts. 4 -- Execute a commit or rollback and END transaction 5 -- Rebuild / recreate your indexes "Alex" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > i am havin

Re: [GENERAL] Porting from ORACLE to PostgSQL

2006-09-05 Thread codeWarrior
Perhaps you should look at EnterpriseDB -- It's an Oracle-compliant wrapper for postgreSQL "gustavo halperin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello > > I need to porting many old ORACLE-oriented-SQL files and I have many > problem with this code. Sometimes t

Re: [GENERAL] Syntax for converting double to a timestamp

2006-09-05 Thread codeWarrior
It's generally considered bad form to use reserved words as column names ""Frank Church"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am trying to create a view based on this query > > 'select *, "timestamp"::timestamp from ccmanager_log' > > > This is the error I get to

Re: [GENERAL] Postrgesql and Mysql in the same server Linux (Fedora core 5)

2006-09-05 Thread codeWarrior
Could you run the unix command 'top' and figure out where your performance degradation is before you assume it is a database issue... "Toffy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > as i put Postrgesql and Mysql in the same server Linux (Fedora core 5), > is it poss