[SQL] pg_restore - don´t restore. Why?

2004-02-19 Thread 2000info
pg_dump, ok. pg_restore, don´t restore. Why?   Red Hat 9, Fedora, Conectiva 9 and Postgres 7.4.1 make my ambient use.   pg_restore -i -v -N -etc... return: Droping... error! Object does not exist...   OR Creating... error! Object exist with the same arguments...  

Re: [SQL] Help refining/eliminating recursive selects

2004-02-19 Thread Yudie
What about something like this: select * from test order by tx_date desc limit 1 Yudie - Original Message - From: "Edmund Bacon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 5:09 PM Subject: [SQL] Help refining/eliminating recursive selects I have

Re: [SQL] Help refining/eliminating recursive selects

2004-02-19 Thread Stephan Szabo
On Thu, 19 Feb 2004, Edmund Bacon wrote: > > I have the following table: > > create table test ( > idserial primary key, > product integer, > tx_date date, > quantity integer) > > with the following data: > id | product | tx_date | quantity > +-+---

[SQL] Help refining/eliminating recursive selects

2004-02-19 Thread Edmund Bacon
I have the following table: create table test ( idserial primary key, product integer, tx_date date, quantity integer) with the following data: id | product | tx_date | quantity +-++-- 1 | 1 | 2004-01-01 | 10 2 |

Re: [SQL] Distributed Transactions

2004-02-19 Thread Tom Lane
"scott.marlowe" <[EMAIL PROTECTED]> writes: > Oh, and update your version of postgresql. There's a nasty "won't > startup" bug in 7.3.2 you'd just as soon rather avoid. Actually I think the "won't start" bug was in 7.3.3 :-(. Still, it's good advice to keep up with the latest version in your re

Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread scott.marlowe
On Thu, 19 Feb 2004, scott.marlowe wrote: > On Thu, 19 Feb 2004, Brian Knox wrote: > > > ( sorry if this is a repeat, my mail server is being wonky today ) > > > > I'm looking for a way, within SQL, given a starting date and an ending > > date, to get back the number of months between the start

Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread scott.marlowe
On Thu, 19 Feb 2004, Brian Knox wrote: > ( sorry if this is a repeat, my mail server is being wonky today ) > > I'm looking for a way, within SQL, given a starting date and an ending > date, to get back the number of months between the start and end date. > If I "SELECT end_date - start_date",

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Jan Wieck
Rodrigo Sakai wrote: AFAIK there's not much you can do for obfuscation of pl functions right now since someone will be able to see the src text in pg_proc. However, are you allowing people that you don't want to see the code access to write arbitrary sql to the database? Let me explain myself a

Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread Brian Knox
( sorry if this is a repeat, my mail server is being wonky today ) I'm looking for a way, within SQL, given a starting date and an ending date, to get back the number of months between the start and end date. If I "SELECT end_date - start_date", I get back an interval in days; I need months. T

Re: [SQL] CHAR(n) always trims trailing spaces in 7.4

2004-02-19 Thread Tom Lane
elein <[EMAIL PROTECTED]> writes: > Somewhere the space trimming occurs. The cast from char(n) to text (or varchar) is what's doing the trimming in 7.4. I think you can mostly revert the change by changing that pg_cast entry to specify no conversion function instead of rtrim(). However that would

Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread Jeremy Smith
Thanks Josh, I'll do that, I just wasn't sure if I was missing something obvious. Jeremy -Original Message- From: Josh Berkus [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 2:29 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [SQL] DISTINCT ON troubles Jeremy, >

Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread Josh Berkus
Jeremy, > Am I just approaching this all wrong and need to create a temporary table > and draw from that, or is there a way to salvage this query? Think about using a subquery instead of the DISTINCT ON approach. I don't think you can get what you want with DISTINCT ON. A temporary table is n

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Josh Berkus
Rodrigo, > I insist in my question, is there a way to compile the plpgsql codes or something like that, or its better to think about writting this postgres functions in C?? No, there is not. Nor is there likely to be for any PL, as it would add significant overhead for no real gain. Y

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Joe Conway
Rodrigo Sakai wrote: I insist in my question, is there a way to compile the plpgsql codes or something like that no think about writting this postgres functions in C?? yes Joe ---(end of broadcast)--- TIP 9: the planner will ignore your desire

Re: [SQL] crosstabs

2004-02-19 Thread Joe Conway
Philippe Lang wrote: I need to do something similar to a cross tabulation, but without any aggregation. See the crosstab() function found in contrib/tablefunc Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister

Re: [SQL] CHAR(n) always trims trailing spaces in 7.4

2004-02-19 Thread elein
I guess I am asking about the cast sequence from char(n) to text. (' '::char(n))::text trims spaces. This is wrong, imo. ' '::text does not trim spaces. ' '::char(n) does not trim spaces and pads. char(n) should not trim spaces, right? And it doesn't on an inser

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Rodrigo Sakai
>AFAIK there's not much you can do for obfuscation of pl functions right >now since someone will be able to see the src text in pg_proc. However, >are you allowing people that you don't want to see the code access to >write arbitrary sql to the database? Let me explain myself a little better. Ac

[SQL] DISTINCT ON troubles

2004-02-19 Thread Jeremy Smith
Hi, I have a query that reads: SELECT DISTINCT ON (messageboard.threadid) messageboard.threadid, messageboard.topic, owner.ownerid, owner.username FROM messageboard, owner WHERE messageboard.ownerid=owner.ownerid AND messageboard.leagueid = '$leagueid' ORDER BY messageboard.messageid DESC LIMIT $

Re: [SQL] crosstabs

2004-02-19 Thread Richard Huxton
On Thursday 19 February 2004 16:02, Philippe Lang wrote: > Hello, > > I need to do something similar to a cross tabulation, but without any > aggregation. Have a look in the contrib/ folder of the source distro (or your contrib package). There are some set-returning tablefunc examples. Also you m

Re: [SQL] crosstabs

2004-02-19 Thread Philippe Lang
Here is a solution: -- QUERY SELECT master_name, CASE WHEN type = 'TA' THEN detail_name END as TA, CASE WHEN type = 'TB' THEN detail_name END as TB, CASE WHEN type = '

Re: [SQL] Distributed Transactions

2004-02-19 Thread scott.marlowe
On Wed, 18 Feb 2004, George A.J wrote: > Hi all, > > i am using PostgreSQL 7.3.2. How can i do distributed transactions in PostgreSQL. > is there a transaction coordinator available for Postgres.. there isn't one, really, but you could likely roll something that worked. Oh, and update your v

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Stephan Szabo
On Thu, 19 Feb 2004, Rodrigo Sakai wrote: >Hi, I'm responsable for the database here in the company, and I like >to know if is there a way to compile my pl/pgsql functions, its not a >performance problem, it is more a security problem, i don like to >have somebody looking into my c

[SQL] crosstabs

2004-02-19 Thread Philippe Lang
Hello, I need to do something similar to a cross tabulation, but without any aggregation. Here is an example: -- TABLE DEFINITION CREATE TABLE public.type ( code char(1)

Re: [SQL] Compiling pl/pgsql functions

2004-02-19 Thread Viorel Dragomir
So use Grant more wisely. - Original Message - From: "Rodrigo Sakai" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 2:44 PM Subject: [SQL] Compiling pl/pgsql functions >Hi, I'm responsable for the database here in the company, and I like to know if is

[SQL] Compiling pl/pgsql functions

2004-02-19 Thread Rodrigo Sakai
Hi, I'm responsable for the database here in the company, and I like to know if is there a way to compile my pl/pgsql functions, its not a performance problem, it is more a security problem, i don like to have somebody looking into my codes and see the company rules. Is there a way to do th