Re: [SQL] converting epoch to timestamp

2005-10-26 Thread Stef
Rajesh Kumar Mallah mentioned : => Can anyone tell me how to convert epoch to timestamp ? => => ie reverse of : => => SELECT EXTRACT( epoch FROM now() ); => +--+ => |date_part | => +--+ => | 1130317518.61997 | => +--+ Here is one way (In m

Re: [SQL] Numeric and CSV under 8.0.1 ?

2005-04-08 Thread Stef
5 at 02:12:11PM -0400, Keith Worthington wrote: > On Fri, 8 Apr 2005 12:51:47 -0400, Stef wrote > > Hello Everyone, > > Currently, here at work, I am doing the whole > > 'advocacy' part of postgreSQL. It's not really hard to > > do, as the other data

[SQL] Numeric and CSV under 8.0.1 ?

2005-04-08 Thread Stef
Hello Everyone, Currently, here at work, I am doing the whole 'advocacy' part of postgreSQL. It's not really hard to do, as the other database's are MySQL and Sybase ;) There is obviously a whole spat of data munging going on in the background, and I noticed that psql in 8.0.1 now

Re: [SQL] [SOLVED] Postgres schema comparison.

2005-03-09 Thread Stef
or so for +- 450 tables on my machine. It may break if you have some exotic definitions that I didn't test for, but I think it's pretty solid as it is here. Kind Regards Stefan Stef mentioned : => Here's my final solution that runs in less than a minute for +- 543 tables : => fo

Re: [ADMIN] [SQL] Postgres schema comparison.

2005-03-08 Thread Stef
Jim Buttafuoco mentioned : => I use dblink to attach to both databases and query pg_namespace, pg_class, pg_attribute ... to get the diffs. See => attached as an example. look for the dblink_connect lines to specify your database. You will need to install => contrib/dblink. I used this with 7

Re: [SQL] [SOLVED] Postgres schema comparison.

2005-03-07 Thread Stef
John DeSoi mentioned : => I'm not sure you can use \d directly, but if you startup psql with the => -E option it will show you all the SQL it is using to run the \d => command. It should be fairly easy to get the strings you need from the => results of running a similar query. The psql source is

Re: [ADMIN] [SQL] Postgres schema comparison.

2005-03-07 Thread Stef
Tom Lane mentioned : => > The problem I have with this, is that I have to run the command per table, => => Why? => => If the problem is varying order of table declarations, try 8.0's => pg_dump. Yes, this will solve the global schema check, but I will still need to split it into "per table" dump

Re: [ADMIN] [SQL] Postgres schema comparison.

2005-03-07 Thread Stef
Markus Schaber mentioned : => Some weeks ago, I posted here a script that uses psql to create split => dumps. Maybe you can reuse some of its logics to create per-table => md5sums for all tables in a database automatically. Thanks, but I've got something very similar to this already. I almost tho

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-07 Thread Stef
John DeSoi mentioned : => Develop a function that builds a string describing the tables/schemas => you want to compare. Then have your function return the md5 sum of the => string as the result. This will give you a 32 character value you can => use to determine if there is a mismatch. OK, this

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-07 Thread Stef
[EMAIL PROTECTED] mentioned : => Are you just synching the schemas, or do you also need to synch the data? Schemas now, data later. To do the data part, I'm thinking of using slony, because it seems to be able to do pretty much everything I need from that side. But, unfortunately I can't even st

Re: [ADMIN] [SQL] Postgres schema comparison.

2005-03-07 Thread Stef
Markus Schaber mentioned : => There are (at least) two independently developed pgdiff applications, => they can be found at: => => http://pgdiff.sourceforge.net/ => => http://gborg.postgresql.org/project/pgdiff/projdisplay.php Thanks a lot! => I did not try the first one, but the latter one wor

[SQL] Postgres schema comparison.

2005-03-07 Thread Stef
Hi all, I've got a master database with many other databases that all have (or is supposed to have) the same exact same schema as the master database (the master database is basically an empty template database containing the schema definition). The problem is that none of the schemas actually

Re: [SQL] Preserving column order when recreating table.

2004-09-15 Thread Stef
dify pieces of the "create table" statement to drop all the indexes and constraints first. Is there an easier way around this? Stef ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] Preserving column order when recreating table.

2004-09-15 Thread Stef
Andrew Sullivan mentioned : => I'm not sure why you want to do the former, but in any case, it's Because lazy people write inserts without specifying column names. => possible by creating a new table which has things the way you want; => select all the old data from the old table into the new tabl

[SQL] Preserving column order when recreating table.

2004-09-15 Thread Stef
Hi all, I'm struggling with a situation where I want to recreate a table (in more than 30 databases) to fix the column order (attnum sequence) and in another case, fix different definitions for the same column in a table e.g. amount numeric(16,2) in stead of : amount numeric(16,5) The complica

Re: [SQL] Maybe install debian on your home pc?

2004-08-12 Thread Stef
Erm .. sorry list people. This one slipped to the wrong address... Stef mentioned : => Hi Marcus, => => Here's something interesting for you : => http://www.gnoppix.org/ => => It looks like it may be more easy to install, as it's => entirely geared towards instal

[SQL] Maybe install debian on your home pc?

2004-08-12 Thread Stef
Hi Marcus, Here's something interesting for you : http://www.gnoppix.org/ It looks like it may be more easy to install, as it's entirely geared towards installation rather than just booting. It says it's based on woody, so I don't know if the 2.6 kernel is a boot option here. Maybe check it out

Re: [SQL] Order of execution of rules

2004-07-12 Thread Stef
Hilary Forbes mentioned : => Can I guarantee that if I have more than one Rule on a table they will be executed in a given order? I know triggers are done alphabetically but is the same true of rules? http://www.postgresql.org/docs/7.4/static/sql-createrule.html#AEN37748 pgpgCnrDhs4Og.pgp Desc

[SQL] ERROR: Unable to format timestamp; internal coding error

2004-06-23 Thread Stef
Hi all, I've narrowed my problem down to the following Java Timestamp that I managed to insert into a postgres 7.3.4 database : Timestamp : '1475666-11-30 02:00:00.0' My problem is, that when I try and select from the table I inserted this timestamp into, I get the following error : ERROR: Una

Re: [SQL] Datetime problem

2004-06-14 Thread Stef
Hello Eric, Are you looking for something like : select to_char(timestamp 'now',' MM DD HH MI SS'); or the values in your example below : select to_char(timestamp '20041010 00:00:00',' MM DD HH MI SS'); Eric Lemes mentioned : => Hello there, => => I'm with a little trouble with postgresq

Re: [SQL] Date format problems

2004-06-03 Thread Stef
te of : 16 Feb 2004 and hides the bottom of my e-mail folder. Cheers Stef ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Exceptions when 0 rows affected.

2004-05-13 Thread Stef
#x27;m sticking to psql though, and managed to create the query with a nested nullif and coalesce to make my query fail if there are 0 rows matching for an update or delete. Cheers Stef ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Exceptions when 0 rows affected.

2004-05-10 Thread Stef
Hi all, I've been looking on Google,the archives and documentation, but cannot find what I'm looking for. Maybe I've read the answer, but it's still evading me. I'm working with postgres 7.3.4 using the psql client. I want to know if it's possible to raise an error in a transactional BEGIN->EN

Re: [SQL] postgres timeout.

2004-01-28 Thread Stef
Forgot to mention that I use postgres 7.3.4 Stef mentioned : => Hi all , => => I'm trying to find out if there is a specific setting => to make transactions time out faster in a scenario => where there's an update on a table in a transaction => block, and another up

Re: [SQL] postgres timeout. [SOLVED]

2004-01-28 Thread Stef
Hi all, It seems I always find a solution just after panicking a little bit. Anyway, I found that statement_timeout solved my problem. When I tested it earlier, I actually made an error, and skipped it as a possible solution. Cheers Stef Stef mentioned : => Forgot to mention that I

[SQL] postgres timeout.

2004-01-28 Thread Stef
Hi all , I'm trying to find out if there is a specific setting to make transactions time out faster in a scenario where there's an update on a table in a transaction block, and another update process tries to update the same column. It looks like the second process will wait until you end the t

Re: [SQL] Fw: postgres logging [SOLVED]

2004-01-23 Thread Stef
Stef mentioned : => The postmaster logs to a separate log file, but at the moment => it's impossible to tell which sql comes from which connection. => Is there an easy way to accomplish this? Erm... sorry , It appears my postgresql.conf is not an original. It didn't have th

[SQL] Fw: postgres logging

2004-01-23 Thread Stef
Hi all, I've switched on log_statement in postgresql.conf for debugging purposes. I tried logging connections and pids as well, but I need to match up the logged statements to specific connections. The postmaster logs to a separate log file, but at the moment it's impossible to tell which sq

[SQL] Historical logging of pg_stat_activity ?

2004-01-13 Thread Stef
ach day and then sort them all and ... but thats a bit of a pain if there is already such a thing in existence. regards Stef ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

[SQL] 'invalid' value in timestamp with timezone.

2003-11-03 Thread Stef
esentation 'valid' I looked in the documentation and on the net, but cannot find much reference to this "ex-feature" I'm 80% sure no one actually inserted these 'invalid' values into tables, and what I need to know is : What else can insert a value of 'invalid&#

Re: [SQL] Table versions

2003-10-29 Thread Stef
Thanks guys, I had a feeling this was the case, but wasn't sure. The one-version pg_dump looks like a winner. Regards Stefan ##START## => Rod Taylor <[EMAIL PROTECTED]> writes: => >> What I did next, is put a trigger on pg_attribute that should, in theory, => >> on insert and update, fire up a f

Re: [SQL] Table versions

2003-10-29 Thread Stef
Correction on the function : The function currently on the database did has select int4(description) + 1 into v_new_version from pg_description where objoid = NEW.attrelid; in stead of select int4(description) into v_new_version from pg_description where objoid = NEW

[SQL] Table versions

2003-10-29 Thread Stef
Hi all, I'm trying to create some kind of table version control system for approximately 300 postgres databases ranging in version from 7.1.2 to 7.3.4. I compared the "pg_dump -s" output between the various versions of databases, but the format is inconsistent, and I can't do diff's to check th

Re: [SQL] Analyze makes queries slow...

2003-08-14 Thread Stef
On Fri, 8 Aug 2003 09:24:48 -0700 Jonathan Gardner <[EMAIL PROTECTED]> wrote: => Try the performance list. Thanks for the tip Stef ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Analyze makes queries slow...

2003-08-06 Thread Stef
Hi all, I have a problem : A select statement that selects from 7 tables, groups the information by 6 columns of the tables involved. When there are no rows in pg_statistics, the query runs under 3 minutes. When I analyze the biggest table of the 7 (approx 100 rows), the query takes longer

[SQL] Referential Integrity Question (Delete/Insert during Transaction)

2001-06-18 Thread Stef Telford
hello again everyone, I seem to have hit what i -think- may be a bug (but i am not crying wolf jst yet ;). I have three tables. action, client and order_details. action has a primary key 'order', client references action (along with adding the client_id as part of its pr

Re: [SQL] breakage in schema with foreign keys between 7.0.3 and 7.1

2001-04-18 Thread Stef Telford
Stephan Szabo wrote: > Hmm, don't know why it's not in changelog, but the spec requires that > the target fields of a foreign key constraint are themselves constrained > by a unique or primary key constraint. maybe its time for me to go and re-read the changelog with a fine tooth comb (it has be

[SQL] breakage in schema with foreign keys between 7.0.3 and 7.1

2001-04-18 Thread Stef Telford
ingly obvious but i cant seem to understand why it was working and now isnt. i even went through the changelog! regards Stef ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister comm

Re: [SQL] Trigger Function and Html Output

2001-04-01 Thread Stef Telford
eral-purpose templating modules. > They'll all handle tables. > thank you for the input, and if i was jst starting out i would agree with you. I cant really explain it any better than i have previously, but hopefully you will see that i want to use the database to do this. hopefully that

[SQL] Trigger Function and Html Output

2001-04-01 Thread Stef Telford
Hello, i find i must turn once again to the list for help, in what is probably another silly request. I have a view (made of 4 tables) and now find that users need to have the view different based on some criteria from the database. its. well. its rather icky to go into. but i can

Re: [SQL] Archival of Live database to Historical database

2001-01-30 Thread Stef Telford
Richard wrote: > > Hello everyone, > > I have hit on a limit in my knowledge and i am looking for > > some guidance. Currently I have two seperate databases, one for > > live data, the other for historical data. The only difference really > > being that the historical data has a Serial in it so th

[SQL] Archival of Live database to Historical database

2001-01-29 Thread Stef Telford
Hello everyone, I have hit on a limit in my knowledge and i am looking for some guidance. Currently I have two seperate databases, one for live data, the other for historical data. The only difference really being that the historical data has a Serial in it so that the tables can keep mo