Re: [GENERAL] difference between implicit/explicit cast of integer to interval

2012-07-01 Thread Tom Lane
raf writes: > Q1) if an integer cannot be explicitly cast into an interval, what is > happening > when a date difference is stored in an interval variable to allow it to > happen? plpgsql is really lax about type coercions. It typically does them by converting the source value to text and then

[GENERAL] difference between implicit/explicit cast of integer to interval

2012-07-01 Thread raf
hi, postgresql-9.1.3 the difference between two dates is an integral number of days as demonstrated by: select select date '2012-08-03' - date '2012-08-01'; ?column? -- 2 i just noticed that i had some (buggy) code that stored the differe

[GENERAL] Test, please ignore.

2012-07-01 Thread David Fetter
$subject! -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fet...@gmail.com iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics Remember to vote! Consider donating to Postgres: http://www.postgresql.org/

Re: [GENERAL] Complex database infrastructure - how to?

2012-07-01 Thread Edson Richter
Em 01/07/2012 04:50, Jasen Betts escreveu: On 2012-06-30, Edson Richter wrote: I've a plan that will need a complex database infra-structure using PostgreSQL 9.1. I've seen similar setups using MS SQL Server and other databases, but all of them support cross database queries (also easy to imple

Re: [GENERAL] How to insert record only if primary key does not exist

2012-07-01 Thread Edson Richter
Em 30/06/2012 10:02, Andrus escreveu: Table is defined as CREATE TABLE firma1.klient ( kood character(12) NOT NULL DEFAULT nextval('firma1.klient_kood_seq'::regclass), ); How to insert record to this table only if primary key does not exist ? I tried code below but got strange error as s

[GENERAL] PostgreSQL Slony-I Replication

2012-07-01 Thread Iqbal Aroussi
Hi dear friends, This my first post to PostgreSQL mailing list. I'm trying to setup a master-slave replication with PostgreSQL 9.1 / Slony-I, this is first time I'm doing it and I'm kind of lost :( Is there any tutorial explaining the steps how to do it with *FreeBSD* ? I'm using FreeBSD db1 9.0

Re: [GENERAL] How to insert record only if primary key does not exist

2012-07-01 Thread Chris Angelico
On Mon, Jul 2, 2012 at 12:19 AM, Craig Ringer wrote: > How to insert record to this table only if primary key does not exist ? > > > You want an operation that's called an UPSERT or MERGE operation. PostgreSQL > doesn't have any native support to do this for you. Doing it right is > surprisingly t

Re: [GENERAL] How to insert record only if primary key does not exist

2012-07-01 Thread Craig Ringer
On 06/30/2012 09:02 PM, Andrus wrote: Table is defined as CREATE TABLE firma1.klient ( kood character(12) NOT NULL DEFAULT nextval('firma1.klient_kood_seq'::regclass), ); How to insert record to this table only if primary key does not exist ? You want an operation that's called an UPSE

[GENERAL] is there any query so that I may find the list of columns those have rules?

2012-07-01 Thread AI Rumman
I am getting the following error: ALTER TABLE base_table ALTER COLUMN base_table_field1 TYPE numeric(10,6); ERROR: cannot alter type of a column used by a view or rule DETAIL: rule _RETURN on view master_view depends on column "base_table_field1" I know that I have a view based in the "base_tabl

Re: [GENERAL] Complex database infrastructure - how to?

2012-07-01 Thread Jasen Betts
On 2012-06-30, Edson Richter wrote: >> Consider using one database with multiple schemas. You can separate >> your applications into their own schemas, and you can have >> cross-schema foreign keys. >> > But how to keep application databases independent from each other? different schemas. >

Re: [GENERAL] Complex database infrastructure - how to?

2012-07-01 Thread Jasen Betts
On 2012-06-30, Edson Richter wrote: > I've a plan that will need a complex database infra-structure using > PostgreSQL 9.1. > I've seen similar setups using MS SQL Server and other databases, but > all of them support cross database queries (also easy to implement with > materialized views). >

Re: [GENERAL] Conversion of columns during CSV Import

2012-07-01 Thread Jasen Betts
On 2012-06-29, Patrick Schneider wrote: > Hello, > > is there any possibility to convert special columns during an CSV import > via COPY? > For example: > > HELLO;WORLD;;011001 > > should be converted to a character field do you mean like '' (easy) or like '香' or like '✏' (harder)