Re: [GENERAL] review db dump script and difference between pg_dump & pg_dumpall

2008-10-09 Thread hubert depesz lubaczewski
On Thu, Oct 09, 2008 at 02:29:30PM +1100, Chris Henderson wrote: > I have written the following script to backup _all_ databases on > various servers that are running postgresql. I don't want anything > fancy - just be able to backup the database and restore when bad times > come. Just posting it h

[GENERAL] psql variable quoting

2008-10-09 Thread Artacus
I'm having quoting issues... or concatenation or just issues when trying to use psql variables. TRUNCATE TABLE :tbl; COPY :tbl FROM x WITH CSV HEADER; For x I want to do a concatenation of :import_path :tbl '.csv' Obviously I can't have the spaces in it. If I remove the spaces, it does

Re: [GENERAL] [pgadmin-support] problem with check constraints

2008-10-09 Thread Julius Tuskenis
Hello, Anton Its ok, because conjunction (AND) has priority over disjunction (OR) so ((A and B) or (C and D)) = (A and B or C and D) Anton Andreev rašė: Hi, When I create a check constraint in PgAdmin3 1.8.4 on a Postgresql 8.3.3: ((A and B) or (C and D)) I get with create script: (A and B

[GENERAL] ROWTYPE inserts

2008-10-09 Thread chrisj
In the 8.3 manual section 38.3.3 it shows a great short cut using ROWTYPEs for selects: CREATE FUNCTION merge_fields(t_row table1) RETURNS text AS $$ DECLARE t2_row table2%ROWTYPE; BEGIN SELECT * INTO t2_row FROM table2 WHERE ... ; It seems to me there should be a corresponding short cut usi

[GENERAL] logging SQL statements

2008-10-09 Thread c k
Is it possible to log all sql statements submitted to database server in a table in that database it self? This will be different from database logs which are written by db server. Regards, CPK

[GENERAL] databases list to file

2008-10-09 Thread Joao Ferreira gmail
Hello all, I need to print to a file a simple list of all the databases on my postgresql. I need to do this from a shell script to be executed without human intervention I guess something like: su postgres -c 'psql ...whatever > /tmp/my_databases.txt' but I don't know exactly to what exten

Re: [GENERAL] databases list to file

2008-10-09 Thread A. Kretschmer
am Thu, dem 09.10.2008, um 15:13:58 +0100 mailte Joao Ferreira gmail folgendes: > Hello all, > > I need to print to a file a simple list of all the databases on my > postgresql. > > I need to do this from a shell script to be executed without human > intervention > > I guess something like: >

[GENERAL] PLSQL function calling another function

2008-10-09 Thread cyw
Hi All, I am trying to figure out how to call one PLSQL function from another, specifically how to access the return values from the callee. I made two test functions, A and B. A calls B. B returns two values: OUT tid integer OUT msg character varying In call

Re: [GENERAL] databases list to file

2008-10-09 Thread Jeff Ross
Joao Ferreira gmail wrote: Hello all, I need to print to a file a simple list of all the databases on my postgresql. I need to do this from a shell script to be executed without human intervention I guess something like: su postgres -c 'psql ...whatever > /tmp/my_databases.txt' but I don

[GENERAL] Run postgresql engine in readonly mode?

2008-10-09 Thread Galland Gregoire
Hi all! I would like to run all my databases in a readonly mode just for a few hours (migration plan). Is it a way to tell the postgresql engine to run in readonly? Sincerly G.Galland -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: h

[GENERAL] create rule on select question

2008-10-09 Thread Grzegorz Jaśkiewicz
test1=# \d+ testb View "public.testb" Column | Type | Modifiers | Description +-++- id | bigint | | pid | integer | | b | integer | not null default 1 | View definition: SELECT testb.id, testb.pid, 1 AS b FROM testb WHERE testb.b <> 0; tes

Re: [GENERAL] PLSQL function calling another function

2008-10-09 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > I am trying to figure out how to call one PLSQL function from another, > specifically how to access the return values from the callee. > I made two test functions, A and B. A calls B. > B returns two values: > OUT tid integer > OUT

Re: [GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-09 Thread Peter Eisentraut
Magnus Hagander wrote: Not having followed the whole discussion here.. But if location is the only issue, we could perhaps provide a repository on the postgresql.org servers for this, in case Debian does not want it on their official ones? It would be a fallacy to assume that space is the only

Re: [GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-09 Thread Markus Wanner
Hi, Peter Eisentraut wrote: > And the problem is that this scheme defines certain buckets > of packages such as stable, testing, unstable, volatile, backports, etc. > that have relationships between them. And unfortunately the maintenance > model that Markus wants for postgresql-8.2 does not fit

[GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
I'm trying to combine two tables, but I only want unique records based on the first two columns. Can UNION be used to join three-column tables but only include records based on the uniqueness of the first two columns? If not, how would I do this with PostgreSQL 8.1? -- Sent via pgsql-general

Re: [GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-09 Thread Joshua D. Drake
Markus Wanner wrote: Hi, ..or simply use another bucket. I'm trying to help Martin Pitt with general purpose Postgres packaging. Maybe we can revive Postgres 8.2 for Debian that way. Or do you see any immediate problem with that strategy? I don't, there are plenty of one off repositories in

Re: [GENERAL] Question About UNION

2008-10-09 Thread Raymond O'Donnell
On 09/10/2008 17:36, Bill Thoen wrote: > I'm trying to combine two tables, but I only want unique records based > on the first two columns. Can UNION be used to join three-column tables > but only include records based on the uniqueness of the first two > columns? If not, how would I do this with P

Re: [GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
Raymond O'Donnell wrote: On 09/10/2008 17:36, Bill Thoen wrote: I'm trying to combine two tables, but I only want unique records based on the first two columns. Can UNION be used to join three-column tables but only include records based on the uniqueness of the first two columns? If not, how

Re: [GENERAL] Question About UNION

2008-10-09 Thread Raymond O'Donnell
On 09/10/2008 17:59, Bill Thoen wrote: >>> I'm trying to combine two tables, but I only want unique records based >>> on the first two columns. Can UNION be used to join three-column tables >>> but only include records based on the uniqueness of the first two >>> columns? If not, how would I do thi

Re: [GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
Raymond O'Donnell wrote: On 09/10/2008 17:59, Bill Thoen wrote: I'm trying to combine two tables, but I only want unique records based on the first two columns. Can UNION be used to join three-column tables but only include records based on the uniqueness of the first two columns? If not, how

Re: [GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
Raymond O'Donnell wrote: On 09/10/2008 17:59, Bill Thoen wrote: I'm trying to combine two tables, but I only want unique records based on the first two columns. Can UNION be used to join three-column tables but only include records based on the uniqueness of the first two columns? If not, how

Re: [GENERAL] Question About UNION

2008-10-09 Thread David Wilson
On Thu, Oct 9, 2008 at 1:48 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: > No, this won't work. Here's an example of my tables: > Table1 > 1, 12, A > 2, 16, B > 8, 6, A > 19, 9, C > > Table2 > 1, 13, D > 2, 16, B > 8, 6, B > 12, 5, A select * from table1 union select table2.* from table2 left join ta

[GENERAL] when COPY violates Primary Keys

2008-10-09 Thread Joao Ferreira gmail
Hello all, I have a ascii dump file based on the COPY operation. lets say I restore this dump into a live database with applications doing INSERTs and UPDATEs onto it. in case the COPY of a register causes a primary key (or UNIQUE, or FK) violation does the psql restore command try to continue t

Re: [GENERAL] Question About UNION

2008-10-09 Thread Josh Williams
On Thu, 2008-10-09 at 10:59 -0600, Bill Thoen wrote: > >> I'm trying to combine two tables, but I only want unique records based > >> on the first two columns. Can UNION be used to join three-column tables > >> but only include records based on the uniqueness of the first two > >> columns? If not,

Re: [GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
David Wilson wrote: On Thu, Oct 9, 2008 at 1:48 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: No, this won't work. Here's an example of my tables: Table1 1, 12, A 2, 16, B 8, 6, A 19, 9, C Table2 1, 13, D 2, 16, B 8, 6, B 12, 5, A select * from table1 union select table2.* from table2 lef

Re: [GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
David Wilson wrote: On Thu, Oct 9, 2008 at 3:31 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: Thanks, but that didn't work. That selected only the records from table1. That's why I warned you about it being written in gmail. :) I'm sorry, you had it right the first time. Here's a scrip

[GENERAL] Fwd: Set-valued function in wrong context

2008-10-09 Thread Raymond O'Donnell
I sent the email below a while ago and haven't seen it appear yet - apologies for the noise if you've already got it. Original Message Subject: Set-valued function in wrong context Date: Thu, 09 Oct 2008 20:04:18 +0100 From: Raymond O'Donnell <[EMAIL PROTECTED]> Reply-To: [EMAIL

Re: [GENERAL] Question About UNION

2008-10-09 Thread Bill Thoen
Josh Williams wrote: On Thu, 2008-10-09 at 10:59 -0600, Bill Thoen wrote: I'm trying to combine two tables, but I only want unique records based on the first two columns. Can UNION be used to join three-column tables but only include records based on the uniqueness of the first two columns? I

Re: [GENERAL] Fwd: Set-valued function in wrong context

2008-10-09 Thread Stephan Szabo
On Thu, 9 Oct 2008, Raymond O'Donnell wrote: > gfc_bookings=# select * from make_time_series('11:00', '14:00', 30); > ERROR: set-valued function called in context that cannot accept a set > CONTEXT: PL/pgSQL function "make_time_series" line 10 at for over > select rows > > Now, I know what the e

Re: [GENERAL] Fwd: Set-valued function in wrong context

2008-10-09 Thread Raymond O'Donnell
On 09/10/2008 21:25, Stephan Szabo wrote: > I think you'd end up wanting something like: > FROM ( select a * interval '1 minute' from generate_series(0, TotalMins, > mins_delta) as s(a) ) as s(a) > > I changed the concatenation and cast into an interval multiply, but you > could easily do things

Re: [GENERAL] logging SQL statements

2008-10-09 Thread Greg Smith
On Thu, 9 Oct 2008, c k wrote: Is it possible to log all sql statements submitted to database server in a table in that database it self? It's possible to cobble together something to appoximate that without too much trouble if you're running V8.3. You can use the CSV log format to make the

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-09 Thread Markus Wanner
Hi, Martin Pitt wrote: > That's in fact the option I have most trouble with. Reason is that > major upstream releases are roughly maintained for five years. All > packages in Lenny main will be supported for Lenny's lifetime, which > is in the order of 4 years (time to release plus, say, 3 years u

Re: [GENERAL] Question About UNION

2008-10-09 Thread David Wilson
On Thu, Oct 9, 2008 at 3:31 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: > Thanks, but that didn't work. That selected only the records from table1. That's why I warned you about it being written in gmail. :) select * from table1 union select table2.* from table2 left join table1 on table2.a=table1

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-09 Thread Martin Pitt
Markus Wanner [2008-10-07 20:08 +0200]: > Okay. Looks like I'm rather trying to join the "official" packaging team > and bring Postgres 8.2 back alive on testing. We'll soon see how that > turns out. That's in fact the option I have most trouble with. Reason is that major upstream releases are r

Re: [GENERAL] when COPY violates Primary Keys

2008-10-09 Thread Chris
Joao Ferreira gmail wrote: Hello all, I have a ascii dump file based on the COPY operation. lets say I restore this dump into a live database with applications doing INSERTs and UPDATEs onto it. in case the COPY of a register causes a primary key (or UNIQUE, or FK) violation does the psql rest

Re: [GENERAL] when COPY violates Primary Keys

2008-10-09 Thread ITAGAKI Takahiro
Chris <[EMAIL PROTECTED]> wrote: > Joao Ferreira gmail wrote: > > in case the COPY of a register causes a primary key (or UNIQUE, or FK) > > violation does the psql restore command try to continue the operation > > until it has parsed the whole dump, or does it abort on the first > > violation ?