Re: [GENERAL] field incrementing in a PL/pgSQL trigger

2004-10-23 Thread Pierre-Frédéric Caillaud
Create a different trigger function for each table, then each trigger can be customized to know the column names. You can generate the triggers from a little script which queries the system tables to get at the column names. It would spit code like 'IF NEW.fieldname != OLD.fieldname THEN (

Re: [GENERAL] Duplicating a database

2004-10-23 Thread Scott Marlowe
On Sat, 2004-10-23 at 22:22, Karim Nassar wrote: > If you just need a working copy, not necessarily right up to date at any > > time, you can just dump and restore it: > > > > pg_dumpall -h source_server |psql -h dest_server > > > > add switches as necessary. > > That would be great for the firs

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 23:51:20 -0500, Bruno Wolff III <[EMAIL PROTECTED]> wrote: > One value I found for a solar year is 365 days, 5 hours, 48 minutes, 45.51 > seconds. Wikipedia gives 365.242189670 days (86400 seconds) as the length of the mean solar year in 2000. To give you some idea of how

Re: [GENERAL] Linking question

2004-10-23 Thread Michael Fuhr
On Thu, Oct 21, 2004 at 09:26:30AM +0300, Katsaros Kwn/nos wrote: > > I want to make use of some contrib/dblink functions inside my user > defined functions, e.g. I would like to be able to call dblink_record() > from my user defined code in this way: > > dblink_record("param1","param2"); > > I

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 23:15:57 -0500, Bruno Wolff III <[EMAIL PROTECTED]> wrote: > by comparing say m1 and m2. This will work as long as f(m,s1) = f(m,s2) > implies s1 = s2. It will probably be desirable to use a subset of these > mappings where f(m,s) = g(m) + h(s). In fact the current system

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 23:36:05 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > > We don't have to have this particular sorting decision, we just have > to have *some* unique sorting order. In particular, if we want to say > that two interval values are not equal, we have to be able to say which

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Tom Lane
Bruno Wolff III <[EMAIL PROTECTED]> writes: > Tom Lane <[EMAIL PROTECTED]> wrote: >> Anybody have any thoughts about a better way to map the multicomponent >> reality into a one-dimensional sorting order? > You could return NULL for cases where the number of months in the > first interval is les

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 21:38:15 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > Doug McNaught <[EMAIL PROTECTED]> writes: > > template1=# select '1 year'::interval = '360 days'::interval; > > ?column? > > -- > > t > > (1 row) > > Yeah, if you look at interval_cmp_internal() it's fairly

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Tom Lane
Doug McNaught <[EMAIL PROTECTED]> writes: > template1=# select '1 year'::interval = '360 days'::interval; > ?column? > -- > t > (1 row) Yeah, if you look at interval_cmp_internal() it's fairly obvious why. I think that this definition is probably bogus, and that only intervals that matc

Re: [GENERAL] Log

2004-10-23 Thread Scott Marlowe
On Fri, 2004-10-22 at 07:52, Davide Negri wrote: > Hello, > > i have installed the 8.0 beta3-dev1 version of postgres on my pc, and > I want to disable log. How can I do? It is possible to disable and > donât write all the log, or how can I write all the log in a specific > directory?? If you us

Re: [GENERAL] how to port Oracle database to PostgreSQL?

2004-10-23 Thread Scott Marlowe
On Wed, 2004-10-20 at 13:47, Vassilev, Lubomir G. wrote: > ok, this is what's going on. i have this VB.NET application with > Oracle 8.1.7 back end, but now i have to switch the whole thing to > PostgreSQL. how do i do that? it's a big database, about 135 tables, a > lot of views, triggers, a few s

Re: [GENERAL] Duplicating a database

2004-10-23 Thread Scott Marlowe
On Thu, 2004-10-21 at 02:39, Karim Nassar wrote: > I need to have an exact copy of a postgres install on a testing > computer. I don't want to do slony. Is it feasible/reasonable to think > that I could just rsync to the devel boxen from the pg server? Or is > slony "The Way to Do It"(tm)? If you

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Doug McNaught
Tom Lane <[EMAIL PROTECTED]> writes: > "Ricardo Perez Lopez" <[EMAIL PROTECTED]> writes: >> I have observed that, for PostgreSQL, one year is actually 360 days: > >> SELECT '1 year'::timestamp = '360 days'::timestamp; > >> ?column? >> - >> t > > Nonsense. > > regression=# SELECT '1

Re: [GENERAL] COPY data and referential triggers ...

2004-10-23 Thread Tom Lane
James Robinson <[EMAIL PROTECTED]> writes: > Just a sanity check -- data fed into pg using the > COPY tablename (col1, col2) FROM stdin; > ... data > \. > Does not cause referential triggers to fire (i.e. foreign keys), right? Sure it does. regression=# create table t1 (f1 int

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Tom Lane
"Ricardo Perez Lopez" <[EMAIL PROTECTED]> writes: > I have observed that, for PostgreSQL, one year is actually 360 days: > SELECT '1 year'::timestamp = '360 days'::timestamp; > ?column? > - > t Nonsense. regression=# SELECT '1 year'::timestamp = '360 days'::timestamp; ERROR: in

Re: [GENERAL] field incrementing in a PL/pgSQL trigger

2004-10-23 Thread Tom Lane
"Tim Vadnais" <[EMAIL PROTECTED]> writes: > My questions are: Is there a way I can dynamically determine the number of > fields in the row that is being maintained. (a function much like: > PQnfields(const PGresult *); ) > Then I need a way to get the name of the field (using a function much like:

[GENERAL] Comment on timezone and interval types

2004-10-23 Thread Bruno Wolff III
Recently there has been some discussion about attaching a timezone to a timestamp and some other discussion about including a 'day' part in the interval type. These two features impact each other, since if you add a 'day' to a timestamp the result can depend on what timezone the timestamp is suppos

Re: [GENERAL] The data directory was initialized by PostgreSQL version 7.3, which is not compatible with this version 7.4.3.

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 10:10:41 +0200, Bilicki Vilmos <[EMAIL PROTECTED]> wrote: > Hi all, > > I have upgraded my cygwin installation and it has replaced my old 7.3 > postgresql. > > My questions are the following: > > How can I use the old files with the newer version? > If this is not poss

Re: [GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Bruno Wolff III
On Fri, Oct 22, 2004 at 13:37:19 +0200, Ricardo Perez Lopez <[EMAIL PROTECTED]> wrote: > Hello everyone: > > I'm a PostgreSQL newbie, working now with dates, times, timestamps and > intervals. > > I have three questions about the above: > > FIRST: > > > I have observed that, for Pos

Re: [GENERAL] sql update max smartries

2004-10-23 Thread Bruno Wolff III
On Thu, Oct 21, 2004 at 18:14:15 -0500, Vic Cekvenich <[EMAIL PROTECTED]> wrote: > I am trying to write a sigle command to update the max number from detail. > > Something like: > update group set max_msgid=max(c.msgid) > from group g, content c > where g.id=c.g_id > > So group is m

[GENERAL] COPY data and referential triggers ...

2004-10-23 Thread James Robinson
Just a sanity check -- data fed into pg using the COPY tablename (col1, col2) FROM stdin; ... data \. Does not cause referential triggers to fire (i.e. foreign keys), right? It seems to operate this way, yet I didn't see this mentioned explicitly in the SQL reference manua

Re: [GENERAL] Duplicating a database

2004-10-23 Thread Bruno Wolff III
On Thu, Oct 21, 2004 at 01:39:26 -0700, Karim Nassar <[EMAIL PROTECTED]> wrote: > I need to have an exact copy of a postgres install on a testing > computer. I don't want to do slony. Is it feasible/reasonable to think > that I could just rsync to the devel boxen from the pg server? Or is > slony

[GENERAL] Problem with 7.4.1 and complicated queries

2004-10-23 Thread Jonathan Weiss
Cheers, I have a problem with postgresql7.4.1 on a SuSE machine. I use the database for a C#-application for a small company to store their clients, sales, etc... This all works flawless since 1 year. Since 2 weeks the database hangs if I perform long queries with views involved in order to genera

[GENERAL] Question on the 8.0Beta Version

2004-10-23 Thread Davide Negri
Hello, i have installed postgres 8.0 beta3 as a program on my pc on windows xp. I have read on the installation note file that postgres server will not run with administrative permissions. I have read on your forum that this happened because i have installed the beta version: is it true t

[GENERAL] how to port Oracle database to PostgreSQL?

2004-10-23 Thread Vassilev, Lubomir G.
ok, this is what's going on. i have this VB.NET application with Oracle 8.1.7 back end, but now i have to switch the whole thing to PostgreSQL. how do i do that? it's a big database, about 135 tables, a lot of views, triggers, a few stored procedures and functions. i understand there are to

Re: [GENERAL] DB modeler

2004-10-23 Thread Bill Harris
[EMAIL PROTECTED] (Jiří Němec) writes: > I am looking for some modeler to create a database structure - tables, > relations etc. I use DBDesigner, but it is primarily designated for > MySQL. Druid (http://druid.sourceforge.net/), although it's not on the list of PostgreSQL GUI tools. Bill -- Bi

[GENERAL] The data directory was initialized by PostgreSQL version 7.3, which is not compatible with this version 7.4.3.

2004-10-23 Thread Bilicki Vilmos
Hi all, I have upgraded my cygwin installation and it has replaced my old 7.3 postgresql. My questions are the following: How can I use the old files with the newer version? If this is not possible, how can I migrate my database to a newer version without the old database engine? If this is not

[GENERAL] how to port Oracle database to PostgreSQL?

2004-10-23 Thread Vassilev, Lubomir G.
ok, this is what's going on. i have this VB.NET application with Oracle 8.1.7 back end, but now i have to switch the whole thing to PostgreSQL. how do i do that? it's a big database, about 135 tables, a lot of views, triggers, a few stored procedures and functions. i understand there is som

[GENERAL] '1 year' = '360 days' ????

2004-10-23 Thread Ricardo Perez Lopez
Hello everyone: I'm a PostgreSQL newbie, working now with dates, times, timestamps and intervals. I have three questions about the above: FIRST: I have observed that, for PostgreSQL, one year is actually 360 days: SELECT '1 year'::timestamp = '360 days'::timestamp; ?column? -

[GENERAL] repost(gmane): sql update max smartries

2004-10-23 Thread Vic Cekvenich
I am trying to write a sigle command to update the max number from detail. Something like: update group set max_msgid=max(c.msgid) from group g, content c where g.id=c.g_id So group is master, content is detail. I want group to stroe max(msgid) from content. Syntax help plz? .V -

[GENERAL] sql update max smartries

2004-10-23 Thread Vic Cekvenich
I am trying to write a sigle command to update the max number from detail. Something like: update group set max_msgid=max(c.msgid) from group g, content c where g.id=c.g_id So group is master, content is detail. I want group to stroe max(msgid) from content. Syntax help plz? .V --

[GENERAL] Problem with 7.4.1 and complicated queries

2004-10-23 Thread Jonathan Weiss
Cheers, I have a problem with postgresql7.4.1 on a SuSE machine. I use the database for a C#-application for a small company to store their clients, sales, etc... This all works flawless since 1 year. Since 2 weeks the database hangs if I perform long queries with views involved in order to gener

[GENERAL] Log

2004-10-23 Thread Davide Negri
Hello, i have installed the 8.0 beta3-dev1 version of postgres on my pc, and I want to disable log. How can I do? It is possible to disable and don’t write all the log, or how can I write all the log in a specific directory??   Thanks   Negri Davide --- Outgoing mail is certif

[GENERAL] schema repository

2004-10-23 Thread stig erikson
Is there a schema repository somewhere? i am looking for a data warehouse clickstream schema to get some view on how others have made such a schema. ---(end of broadcast)--- TIP 8: explain analyze is your friend

[GENERAL] Duplicating a database

2004-10-23 Thread Karim Nassar
I need to have an exact copy of a postgres install on a testing computer. I don't want to do slony. Is it feasible/reasonable to think that I could just rsync to the devel boxen from the pg server? Or is slony "The Way to Do It"(tm)? \<. ---(end of broadcast)-

[GENERAL] field incrementing in a PL/pgSQL trigger

2004-10-23 Thread Tim Vadnais
Hi, My boss wants to add some logging functionality to some of our tables on update/delete/insert. I need to log who, when, table_name, field name, original value and new value for each record, but only logging modified fields, and he wants me to do this wing postgres pgSQL triggers. We are give

[GENERAL] character encoding problem with delphi

2004-10-23 Thread PavelK
Hello, I have a problem using latin2 in postgresql 8 (beta2) with Delphi, with settings client_encoding = server_encoding = latin2 for database there is no way I could post special characters to database, i try with BDE ,dbexpress, delphi 5 & 7 and usualy receive: ignoring unconvertible UTF-8 cha

Re: [GENERAL] OID's

2004-10-23 Thread Tom Lane
Mike Nolan <[EMAIL PROTECTED]> writes: >> You are correct. nextval() is guaranteed never to give the same number >> (unless setval() were used to reset the sequence value). > Or unless the sequence wraps around. That's less likely (and less > dangerous) than having the OID wrap around, but not

Re: [GENERAL] OID's

2004-10-23 Thread Dennis Bjorklund
On Sat, 23 Oct 2004, Mike Nolan wrote: > I personally believe that there is value in a database-generated unique > value like Oracle's ROWID. (Part of what I like about it is that since > it is a system column it simplifies some application issues, since the > app never has to worry about that co

Re: [GENERAL] Win installed pgsql 8.0 beta2 dev3

2004-10-23 Thread Gary Doades
On 23 Oct 2004 at 10:42, A. Mous wrote: > > Note, if I install the ODBC driver separately, these characters do not show > up. Therefore, this seems to be an issue specific to the Win installer, no? > No, not as such. It is a problem with the version of the ODBC driver that ships with Beta2 De

Re: [GENERAL] OID's

2004-10-23 Thread Mike Nolan
> You are correct. nextval() is guaranteed never to give the same number > (unless setval() were used to reset the sequence value). Or unless the sequence wraps around. That's less likely (and less dangerous) than having the OID wrap around, but not impossible. I personally believe that there

[GENERAL] Win installed pgsql 8.0 beta2 dev3

2004-10-23 Thread A. Mous
Not sure if this is a win installer issue or Microsoft MDAC issue... I've installed the win32 pg8.0 beta2 dev3 along with the accompanying ODBC that is packaged with the installer. Works great, love it, and all the rest. My application uses ADO 2.7 to interface with the ODBC driver. My applicat

Re: [GENERAL] OID's

2004-10-23 Thread Oliver Elphick
On Sat, 2004-10-23 at 17:46 +0200, Leen Besselink wrote: > Eddy Macnaghten zei: > > I think you are correct in not using OIDs, as, firstly, as you point out > > they are optional, also that they are not neccessarily unique. > > > > I'm sorry Eddy, but you most be mistaken: > > Every row in POSTGR

Re: [GENERAL] OID's

2004-10-23 Thread Stephan Szabo
On Sat, 23 Oct 2004, Leen Besselink wrote: > Eddy Macnaghten zei: > > I think you are correct in not using OIDs, as, firstly, as you point out > > they are optional, also that they are not neccessarily unique. > > > > I'm sorry Eddy, but you most be mistaken: > > Every row in POSTGRESQL is assigne

Re: [GENERAL] Slony-I 1.0.4 Released

2004-10-23 Thread Oliver Elphick
On Fri, 2004-10-22 at 22:26 -0400, Christopher Browne wrote: > > I suspected it, I currently can not use it because of this. Any > > chance to have a slony rpm compatible with the 7.4.5 rpm ? > > If someone contributes RPM packages, using the same GCC and the same > RPM source RPM, then presumably

Re: [GENERAL] OID's

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 14:52:31 +0200, Leen Besselink <[EMAIL PROTECTED]> wrote: > > id = nextval ("whatever_id_seq"); > insert into whatever (id, text) values (id, 'something'); > > Something that works always... better, but you need to know the name of > the sequence, bummer. In 8.0 (curren

Re: [GENERAL] returning inserted rows, derived tables design

2004-10-23 Thread Bruno Wolff III
On Sat, Oct 23, 2004 at 12:30:07 +0200, Ruediger Herrmann <[EMAIL PROTECTED]> wrote: > Hello again, > > as I am new to PostgreSQL (great pice of softwork btw) this probably won't > be the last question. > > I access PostgreSQL from Java via the PostgreSQL JDBC driver. I am > currently building

[GENERAL] COPY command with PHP

2004-10-23 Thread Robert Fitzpatrick
I have a PHP script that was having problems using the COPY command with files around 1500 lines in size. The script will build the copy data from incoming CSV file into a temp file, then start a COPY command and loop through the copy data using pg_put_line to insert and then pg_end_copy after post

Re: [GENERAL] OID's

2004-10-23 Thread Leen Besselink
Eddy Macnaghten zei: > I think you are correct in not using OIDs, as, firstly, as you point out > they are optional, also that they are not neccessarily unique. > I'm sorry Eddy, but you most be mistaken: Every row in POSTGRESQL is assigned a unique, normally invisible number called an object ide

Re: [GENERAL] OID's

2004-10-23 Thread Doug McNaught
Eddy Macnaghten <[EMAIL PROTECTED]> writes: > The other thing to be aware of is if a large number of people are > writing to the database concurrently it can go wrong (any method). That > is if you insert a record (using nextval for the sequence), then someone > else quickly inserts a row too bef

Re: [GENERAL] Bug or stupidity

2004-10-23 Thread Stephan Szabo
On Sat, 23 Oct 2004, Philip Hofstetter wrote: > > As for what's SQL standard, I think by a strict definition your query > > shouldn't be allowed at all, referencing an undefined table. > > This is exactly what I think too. I mean: I know I made an error in my > query. It would just have been easie

Re: [GENERAL] Bug or stupidity

2004-10-23 Thread Martijn van Oosterhout
On Sat, Oct 23, 2004 at 02:35:20PM +, Philip Hofstetter wrote: > >As for what's SQL standard, I think by a strict definition your query > >shouldn't be allowed at all, referencing an undefined table. > > This is exactly what I think too. I mean: I know I made an error in my > query. It would

Re: [GENERAL] OID's

2004-10-23 Thread Eddy Macnaghten
I think you are correct in not using OIDs, as, firstly, as you point out they are optional, also that they are not neccessarily unique. The use of sequences is an idea, however, why the complication? Why not simply use a sequence called "mytable_sequence", or "mytable_id" where "mytable" is the n

Re: [GENERAL] Bug or stupidity

2004-10-23 Thread Philip Hofstetter
Hi, Martijn van Oosterhout wrote: popscan_light=> select aliasa.name, aliasb.name2 from a aliasa left join b aliasb using (id) order by b.name2; NOTICE: adding missing FROM-clause entry for table "b" name | name2 ---+--- gnegg | gnegglink blepp | blepplink gnegg | gnegglink blepp |

Re: [GENERAL] Bug or stupidity

2004-10-23 Thread Martijn van Oosterhout
On Sat, Oct 23, 2004 at 02:17:16PM +, Philip Hofstetter wrote: > Hello, > > I think, I found a bug, but maybe it's just my stupidity. Granted: What > I did was an error on my part, but I still think, PostgreSQL should not > do what it does. ... snip ... > popscan_light=> select aliasa.name

Re: [GENERAL] combining two queries?

2004-10-23 Thread Eddy Macnaghten
select b.name as viewer, count(*) from viewer_movies a, xenons b where b.id = a.viewerid group by b.name On Sat, 2004-10-23 at 00:55, Mark Harrison wrote: > How can I combine these two queries? > > # select viewerid,count(*) from viewer_movies group by viewerid order by viewerid; > viewerid |

[GENERAL] Bug or stupidity

2004-10-23 Thread Philip Hofstetter
Hello, I think, I found a bug, but maybe it's just my stupidity. Granted: What I did was an error on my part, but I still think, PostgreSQL should not do what it does. I've already created a simple testcase: popscan_light=> create table a (id serial, name varchar(10), primary key(id)) without o

[GENERAL] PostgreSQL Security Release(s) for 7.2, 7.3 and 7.4

2004-10-23 Thread Marc G. Fournier
In order to address a recent security report from iDefence, we have released 3 new "point" releases: 7.2.6, 7.3.8 and 7.4.6 Although rated only a Medium risk, according to their web site: "A vulnerability exists due to the insecure creation of temporary files, which could possibly let a malicio

[GENERAL] OID's

2004-10-23 Thread Leen Besselink
Hi pgsql-general, (all examples are pseudo-code) We really love PostgreSQL, it's getting better and better, there is just one thing, something that has always led to some dislike: OID's I understand why they did it and all, but still. To make life easier, it's always good to find a general way

[GENERAL] returning inserted rows, derived tables design

2004-10-23 Thread Ruediger Herrmann
Hello again, as I am new to PostgreSQL (great pice of softwork btw) this probably won't be the last question. I access PostgreSQL from Java via the PostgreSQL JDBC driver. I am currently building a little framework that provides basic CRUD operations by mapping class properties to database colum

Re: [GENERAL] Problem with query plan

2004-10-23 Thread Gaetano Mendola
Tom Lane wrote: Cott Lang <[EMAIL PROTECTED]> writes: Fiddling with the above values, only setting sort_mem absurdly large easily causes NAN. Ah. I see an overflow case for sort_mem exceeding 1Gb; that's probably what you tickled. I've fixed this in HEAD, but it doesn't seem worth back-patching

Re: [GENERAL] index not used?

2004-10-23 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Scott Marlowe wrote: | On Fri, 2004-10-22 at 17:11, Gaetano Mendola wrote: | |>Scott Marlowe wrote: |> |>>On Wed, 2004-10-20 at 08:06, Dan Pelleg wrote: |>> |>> |>>>I'm trying to access a table with about 120M rows. It's a vertical version |>>>of a tabl