Re: [GENERAL] Verifying a timestamp is null or in the past

2011-12-30 Thread Alexander Farber
Hello again, please 1 more question: can I have a SELECT statement inside of an IF-conditional? The doc http://www.postgresql.org/docs/8.4/static/plpgsql-control-structures.html does not list such an example. I'm asking, because I'd like to get rid of the has_vip variable in my rewritten procedu

Re: [GENERAL] streaming replication vacuum

2011-12-30 Thread Magnus Hagander
On Fri, Dec 30, 2011 at 07:35, dhaval jaiswal wrote: > > Might be discussed but not clear for the below query. > > In async. streaming replication do I need to run VACUUM & ANALYZE on both > master & slave. > Bec, while querying on master getting below result, but slave's system table > is not upd

Re: [GENERAL] Verifying a timestamp is null or in the past

2011-12-30 Thread Alban Hertroys
On 29 Dec 2011, at 19:15, Alexander Farber wrote: > I'm trying to create PL/pgSQL procedure allowing > players with enough vip status left > to give a week of it to other users, as a "gift": > > create or replace function pref_move_week(_from varchar, >_to varchar) returns void as $BODY$ >

[GENERAL] How to get the time zone offset

2011-12-30 Thread Cezariusz Marek
I need to convert timestamp to a format with a time zone offset, like this: select clock_timestamp()::text; and it returns the following value: "2011-12-30 11:59:06.538+01" What is the default format for timestamp::text conversion? I've tried this: select to_char(clock_timestamp(), '-MM-D

[GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Culley Harrelson
Hello I am trying to migrate a database from 8.4.0 to 9.1.2 on a test server before updating the production server. When piping the dump file created with pg_dump in psql I am getting duplicate key errors and the primary keys on several large tables do not get created. I have read all the migrati

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 6:32:56 am Culley Harrelson wrote: > Hello I am trying to migrate a database from 8.4.0 to 9.1.2 on a test > server before updating the production server. When piping the dump file > created with pg_dump in psql I am getting duplicate key errors and the > primary keys

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Culley Harrelson
They are just your standard sql errors seen in the output of psql mydb < backup.sql ALTER TABLE ERROR: could not create unique index "ht_user_pkey" DETAIL: Key (user_id)=(653009) is duplicated. There is a unique index on user_id in the 8..4.0 system and, of course, only one record for 653009.

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 7:49:31 am Culley Harrelson wrote: > They are just your standard sql errors seen in the output of psql mydb < > backup.sql > > > ALTER TABLE > ERROR: could not create unique index "ht_user_pkey" > DETAIL: Key (user_id)=(653009) is duplicated. > > There is a unique

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Culley Harrelson
There is not any data in the new database. I have dropped the database, created the database and then piped in the backup every time. On Fri, Dec 30, 2011 at 8:06 AM, Adrian Klaver wrote: > On Friday, December 30, 2011 7:49:31 am Culley Harrelson wrote: > > They are just your standard sql error

Re: [GENERAL] How to get the time zone offset

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 6:18:05 am Cezariusz Marek wrote: > I need to convert timestamp to a format with a time zone offset, like this: > > select clock_timestamp()::text; > > and it returns the following value: > > "2011-12-30 11:59:06.538+01" > > What is the default format for timestamp:

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Nigel Heron
On 11-12-30 10:49 AM, Culley Harrelson wrote: They are just your standard sql errors seen in the output of psql mydb < backup.sql ALTER TABLE ERROR: could not create unique index "ht_user_pkey" DETAIL: Key (user_id)=(653009) is duplicated. There is a unique index on user_id in the 8..4.0

Re: [GENERAL] How to get the time zone offset

2011-12-30 Thread Cezariusz Marek
Adrian Klaver wrote: > On Friday, December 30, 2011 6:18:05 am Cezariusz Marek wrote: >> I need to convert timestamp to a format with a time zone offset, like this: >> select clock_timestamp()::text; >> and it returns the following value: >> "2011-12-30 11:59:06.538+01" >> What is the default forma

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 8:12:27 am Culley Harrelson wrote: > There is not any data in the new database. I have dropped the database, > created the database and then piped in the backup every time. > Well another fine theory shot in the :) Questions: 1) Have you gone through the plain text

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Bèrto ëd Sèra
Hi! > Are you sure there is just one record? What happens if you grep the backup file for "653009"? If you do have more than one such record, the quickest way out is to manually clean it. Bèrto -- == If Pac-Man had affected us as kids, we'd all be running around

Re: [GENERAL] How to get the time zone offset

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 8:19:51 am Cezariusz Marek wrote: > > Because I need more control. In this case I need the date in XML format, so > it will be something like this: > > select to_char(clock_timestamp(), '-MM-DD"T"HH24:MI:SSTZ'); So something like this: test(5432)postgres=#select

[GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread Carlos Mennens
I've been asked to stand up a dedicated database server for a new office. They're only requirement is the server run RHEL 6.2 64-bit. I told them no problem as I'm very familiar with Linux and installing / configuring PostgreSQL. So after I've installed RHEL 6.2, I then installed PostgreSQL and the

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Culley Harrelson
This is just the first of many duplicate key errors that cause primary key creation statements to fail on other tables. I grepped for the key but it is hard to tell where the problem is with 888 matches. I will try pg_dump --inserts. It is a 17G file with copy statements so... this should be int

Re: [GENERAL] How to get the time zone offset

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 8:19:51 am Cezariusz Marek wrote: > > Is the timestamp::text format always the same, regardless of the current > locale and language settings? Now I have an answer. It can be changed via the DateStyle setting in postgresql.conf http://www.postgresql.org/docs/9.1/in

Re: [GENERAL] duplicate key errors when restoring 8.4.0 database dump into 9.1.2

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 8:51:17 am Culley Harrelson wrote: > This is just the first of many duplicate key errors that cause primary key > creation statements to fail on other tables. I grepped for the key but it > is hard to tell where the problem is with 888 matches. > > I will try pg_dump

[GENERAL] How to get the time zone offset

2011-12-30 Thread Cezariusz Marek
I need to convert timestamp to a format with a time zone offset, like this: select clock_timestamp()::text; which returns: "2011-12-30 11:59:06.538+01" What is the default format for timestamp::text conversion? I've tried this: select to_char(clock_timestamp(), '-MM-DD HH24:MI:SSTZ'); Bu

[GENERAL] pgoledb transaction error

2011-12-30 Thread gato pardo
Hi: I am moving my data from windows-mssql to Linux-postgresql, but I'am still accessing the data from windows using pgoledb - in order to have compatibility with he old system. Everything is working ok, except when transactions are involved. Examining in this list I found the same kind o

[GENERAL] How to get the time zone offset using to_char

2011-12-30 Thread Cezariusz Marek
I need to convert timestamp to a format with a time zone offset, like this: select clock_timestamp()::text; which returns: "2011-12-30 11:59:06.538+01" What is the default format for timestamp::text conversion? I've tried this: select to_char(clock_timestamp(), '-MM-DD HH24:MI:SSTZ'); But

[GENERAL] How to get the time zone offset using to_char

2011-12-30 Thread Cezariusz Marek
I need to convert timestamp to a format with a time zone offset, like this: select clock_timestamp()::text; which returns: "2011-12-30 11:59:06.538+01" What is the default format for timestamp::text conversion? I've tried this: select to_char(clock_timestamp(), '-MM-DD HH24:MI:SSTZ'); But

[GENERAL] How to get the time zone offset using to_char

2011-12-30 Thread Cezariusz Marek
I need to convert timestamp to a format with a time zone offset, like this: select clock_timestamp()::text; which returns: "2011-12-30 11:59:06.538+01" What is the default format for timestamp::text conversion? I've tried this: select to_char(clock_timestamp(), '-MM-DD HH24:MI:SSTZ'); But

Re: [GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread Carlos Mennens
Yeah I absolutely despise Gentoo for that exact reason. I don't have that kind of time and patience to spend on keeping my system up and running. I've spoken with the team and we've agreed to install Debian Linux which is my distribution of choice and it supports 9.1.2. Thanks! On Fri, Dec 30, 20

[GENERAL] How to get the time zone offset

2011-12-30 Thread Cezariusz Marek
I need to convert timestamp to a format with a time zone offset, like this: select clock_timestamp()::text; which returns: "2011-12-30 11:59:06.538+01" What is the default format for timestamp::text conversion? I've tried this: select to_char(clock_timestamp(), '-MM-DD HH24:MI:SSTZ'); Bu

Re: [GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread Devrim GÜNDÜZ
Hi, On Fri, 2011-12-30 at 11:50 -0500, Carlos Mennens wrote: > My question is how exactly would I > install the latest version of PostgreSQL (9.1.2) on RHEL 6.2? We have PostgreSQL yum repository: http://yum.postgresql.org Install repository RPM first: http://yum.postgresql.org/9.1/redhat/rhe

[GENERAL] Data Type for Money

2011-12-30 Thread Carlos Mennens
I'm trying to understand what is the recommended data type for $ in PostgreSQL. I've done some research and from what I've gathered, there are a few options: 1. decimal 2. money I've read the 'money' data type is non-standard and I should avoid using this. I see it a bunch of Microsoft SQL Server

Re: [GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread Carlos Mennens
2011/12/30 Devrim GÜNDÜZ : > Hi, > > On Fri, 2011-12-30 at 11:50 -0500, Carlos Mennens wrote: >> My question is how exactly would I >> install the latest version of PostgreSQL (9.1.2) on RHEL 6.2? > > We have PostgreSQL yum repository: > > http://yum.postgresql.org > > Install repository RPM first:

Re: [GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread devrim
This message has been digitally signed by the sender. Re___GENERAL__Dated_Version_of_PostgreSQL.eml Description: Binary data - Hi-Tech Gears Ltd, Gurgaon, India -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscr

Re: [GENERAL] Data Type for Money

2011-12-30 Thread Adrian Klaver
On Friday, December 30, 2011 9:41:18 am Carlos Mennens wrote: > I'm trying to understand what is the recommended data type for $ in > PostgreSQL. I've done some research and from what I've gathered, there > are a few options: > > 1. decimal > 2. money > > I've read the 'money' data type is non-st

Re: [GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread Devrim GÜNDÜZ
On Fri, 2011-12-30 at 12:42 -0500, Carlos Mennens wrote: > Question, how do you keep this package updated? > Does it auto update when a new version is released and I run the 'yum > upgrade postgresql' command or do I need to run a special command to > update off this special repository? yum updat

Re: [GENERAL] How to get the time zone offset

2011-12-30 Thread Cezariusz Marek
Cezariusz Marek wrote: > I need to convert timestamp to a format with a time zone offset, like this: > [...] I'm very sorry for multiple posting, those messages were holded because of some filters, and now apparently someone approved them. --

Re: [GENERAL] Dated Version of PostgreSQL

2011-12-30 Thread devrim
This message has been digitally signed by the sender. Re___GENERAL__Dated_Version_of_PostgreSQL.eml Description: Binary data - Hi-Tech Gears Ltd, Gurgaon, India -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscr

Re: [GENERAL] Data Type for Money

2011-12-30 Thread Carlos Mennens
On Fri, Dec 30, 2011 at 12:46 PM, Adrian Klaver wrote: > My guess is it is listed as numeric which is equivalent to decimal: > > http://www.postgresql.org/docs/9.1/interactive/datatype-numeric.html Thanks. I just for some reason can't see or understand the difference between 'decimal' & 'numeric'

Re: [GENERAL] Data Type for Money

2011-12-30 Thread Tom Lane
Carlos Mennens writes: > Thanks. I just for some reason can't see or understand the difference > between 'decimal' & 'numeric'. Why have two data types for the same > values? Am I missing something? There isn't any difference, in Postgres. There are two type names because the SQL standard requir

Re: [GENERAL] Verifying a timestamp is null or in the past

2011-12-30 Thread Alexander Farber
Awesome advices here. Thank you and happy new year. On Fri, Dec 30, 2011 at 2:07 PM, Alban Hertroys wrote: > select 1 from pref_users where id=_from and vip > current_timestamp + > interval '1 week'; > > if not found then >    return; > end if; > > "found" is a special pl/psql keyword that tel

[GENERAL] Would whoever is at "Hi-Tech Gears Ltd, Gurgaon, India" fix their mailer?

2011-12-30 Thread Tom Lane
Whoever you are, you are forging Devrim Gunduz's name to "signed" reposts of all his posts in pgsql-general. This is at best impolite to Devrim, and it's annoying everybody else. If it continues I will see to it that you get removed from this mailing list. [ latest example attached ]

Re: [GENERAL] Data Type for Money

2011-12-30 Thread Dann Corbit
From: http://msdn.microsoft.com/en-us/library/windows/desktop/ms710150(v=vs.85).aspx ODBC type SQL_DECIMAL maps to SQL type DECIMAL(p,s) Signed, exact, numeric value with a precision of at least p and scale s. (The maximum precision is driver-defined.) (1 <= p <= 15; s <= p).[4] ODBC type SQL_N

Re: [GENERAL] pgoledb transaction error

2011-12-30 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of gato pardo Sent: Friday, December 30, 2011 8:39 AM To: pgsql-general@postgresql.org Subject: [GENERAL] pgoledb transaction error Hi: I am moving my data from windows-mss

[GENERAL] join and having clause

2011-12-30 Thread Alexander Farber
Hello, I have an 8.4.9 table, where users can assess other users (i.e. "nice" vs. "not nice"): # \d pref_rep Table "public.pref_rep" Column |Type | Modifiers +-+

Re: [GENERAL] join and having clause

2011-12-30 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Alexander Farber Sent: Friday, December 30, 2011 6:16 PM To: pgsql-general Subject: [GENERAL] join and having clause Hello, I have an 8.4.9 table, where users can assess ot

[GENERAL] Large Objects and and Vacuum

2011-12-30 Thread Simon Windsor
Hi I am struggling with the volume and number of XML files a new application is storing. The table pg_largeobjects is growing fast, and despite the efforts of vacuumlo, vacuum and auto-vacuum it keeps on growing in size. The main tables that hold large objects are partitioned and every few

Re: [GENERAL] streaming replication vacuum

2011-12-30 Thread Scott Marlowe
On Fri, Dec 30, 2011 at 5:03 AM, Magnus Hagander wrote: > On Fri, Dec 30, 2011 at 07:35, dhaval jaiswal wrote: >> >> Might be discussed but not clear for the below query. >> >> In async. streaming replication do I need to run VACUUM & ANALYZE on both >> master & slave. >> Bec, while querying on m

Re: [GENERAL] streaming replication vacuum

2011-12-30 Thread Simon Riggs
On Sat, Dec 31, 2011 at 12:06 AM, Scott Marlowe wrote: > On Fri, Dec 30, 2011 at 5:03 AM, Magnus Hagander wrote: >> On Fri, Dec 30, 2011 at 07:35, dhaval jaiswal wrote: >>> >>> Might be discussed but not clear for the below query. >>> >>> In async. streaming replication do I need to run VACUUM &

Re: [GENERAL] Verifying a timestamp is null or in the past

2011-12-30 Thread Alexander Farber
Hello again, > On Fri, Dec 30, 2011 at 2:07 PM, Alban Hertroys wrote: >> select 1 from pref_users where id=_from and vip > current_timestamp + >> interval '1 week'; >> >> if not found then >>    return; >> end if; >> unfortunately I get the error in PostgreSQL 8.4.9: # select pref_move_week('D

Re: [GENERAL] Verifying a timestamp is null or in the past

2011-12-30 Thread Alexander Farber
Is it because my procedure is declared as "void"? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general