Re: [SQL] reading WAL files in python

2008-01-07 Thread C.
On Mon, 2008-01-07 at 10:19 -0300, Gerardo Herzig wrote: > Hi all. Im having some fun trying to write my own replication system > using python. I will use the postgres own WAL archiving to write the > files, then my app will read them and do some stuff. As im not a C > programmer,

[SQL] benchmarks

2000-10-27 Thread Clayton C.
hi all, lately at work there has been a debate over mysql versus postgres im just looking for independent benchmarks i personally love postgres at work they like mysql currently we are investigating other possible db solutions and they are looking at oracle, i think we could save a lot of d

[SQL] Returning records from a function

2003-02-06 Thread John C
I've spent the last few hours trying to come up with a function that at the most basic returns the result of a SELECT * FROM . This is easy to do in something like MSSQL or Oracle. For example in MSSQL i can do something like: CREATE PROCEDURE proc_name AS BEGIN SELECT * FROM sometable END H

[SQL] Returning Multiple Values from CASE statement?

2003-05-30 Thread C F
Hello, This is probably an odd request, but I have my reasons :)  Basically, what I need to do is return *multiple* values each for a number of criteria.  Imagine being able to return multiple values for each CASE statement... that's what I'm trying to do.  I can solve this with subqueries, but as

[SQL] SQL Help

2003-05-31 Thread C F
Hello, I already tried this same basic question with no response  maybe I was too wordy.  So here it is simplified what's the best way to write this query?  I'm open to using stored procedures, but even then I don't know how I would conditionally populate a resultset (refcursor).  Notice th

Re: [SQL] CASE returning multiple values (was SQL Help)

2003-05-31 Thread C F
I was afraid someone was going to ask that :) Okay, I'll do my best at explaining where I'm coming from I'm working on a mapping application it is user-configurable.  What this means (as it pertains to this disucssion) is that the through a configuration file, the user is able to define the ru

[SQL] Inserting into table only if the row does not already exist.

2004-10-14 Thread C. Bensend
Hey folks, I am inserting data into a table with a three-column primary key (the table is only three columns). The rows I'm trying to insert may very well be duplicates of ones already in the table, so I would like to have PostgreSQL handle the insert and possible error resulting from dup dat

Re: [SQL] Inserting into table only if the row does not already

2004-10-15 Thread C. Bensend
> You just have to put it in the select list as a constant. If you're > feeling > generous to the next programmer to read it you could put "AS column1" > after > each one, but the column name doesn't actually have to match the column > you're > inserting into. Sweet GOD, I hope no one ever has to

Re: [SQL] Inserting into table only if the row does not already

2004-10-16 Thread C. Bensend
> Even cron'd scripts can run amok. Lock files are great as a CYA > measure even if you're relatively certain there will be no opportunity > for one copy to step on the next. Yes, you are absolutely correct, of course. :) I should be more specific - I'm working on a personal project, and I'm no

Re: [SQL] Inserting into table only if the row does not already

2004-10-16 Thread C. Bensend
> Gee, now I have images of late-night advertisements for bofh-porn video > tapes > of Cron Jobs Gone Wild(tm) dancing through my head... thanks. Wow. THERE'S something I didn't need before hitting the sack. ;) Benny -- "Even if a man chops off your hand with a sword, you still have two nic

[SQL] Stuffing six separate columns into a single array?

2004-10-04 Thread C. Bensend
27;0.0.0.0'::inet (yes, I know, I didn't know any better) It is being replaced by: dns_ptr| inet[] | default ...etc (hopefully this is more intelligent) Now, as I migrate the data from the old table to the new, is there any way to just do the

Re: [SQL] Stuffing six separate columns into a single array?

2004-10-05 Thread C. Bensend
> How does dns_ptr relate to other data? Depending on what you're > doing, other ways of organizing your tables might also make sense. These are actually DNS servers authoritive for a domain that is stored in a VARCHAR() in the same table. After sleeping on it, I think using an array is indeed

[SQL] Impact of foreign keys on a simple count(*) ?

2004-10-08 Thread C. Bensend
Hey folks (long email, my apologies), I am wrapping up my schema upgrade, and I just noticed a real show-stopper for me... Here is the "before" table structure: email_id | integer | not null joejob| boolean | default false bayes

Re: [SQL] Impact of foreign keys on a simple count(*) ?

2004-10-08 Thread C. Bensend
> Foreign keys have zero, nada, zilch to do with the performance of > count(*). OK, I just wanted to make sure. > The only plausible theory I can think of for the performance > difference is that in your "new" database the table has been through > several mass updates, leading to a whole lot of

[SQL] append fields for *where...*

2005-02-10 Thread Johnny C
I have the following tables: TABLE A month | year | item | num 1 2005 myitem 003 TABLE B num| date | descr 003 02-01-2005 blahblah 003 01-01-2005 toratora I am trying to come up with something li

[SQL] "Installing" dbLink

2006-02-24 Thread Richard C
Hi   When I execute the query:   SELECT *FROM dblink('dbname=Bas','SELECT id FROM person') AS t(a int)WHERE t.a > 9000 AND T.a < 9050;   I receive the error message   ERROR:  function dblink("unknown", "unknown") does not exist   How do I install or setup the function dbLink so that I ca

Re: [SQL] "Installing" dbLink

2006-02-25 Thread Richard C
Hi. Thanks for the assistance. I have another question. Is it possible to install this function on Window XP?"A. Kretschmer" <[EMAIL PROTECTED]> wrote: am 24.02.2006, um 11:48:44 + mailte Richard C folgendes:> Hi> > When I execute the query: > > SELECT *> F

[SQL] dbLink Query

2006-02-28 Thread Richard C
Hi   When I execute the query:   SELECT *FROM dblink('dbname=Bas','SELECT id FROM person') AS t(a int)WHERE t.id > 9000 AND T.ID < 9050;   I receive the error message   ERROR:  function dblink("unknown", "unknown") does not exist   How do I install or setup the function dbLink so that I

[SQL] Date ranges + DOW select question

2006-06-21 Thread joseppi c
Hi, I have a table which contains starttime, endtime and DOW; i.e. a weekly list of times for when a process must be started and ended. TABLE: cronTimes FIELDS: starttime, endtime, dayOfWeek I have another table which contains date ranges. TABLE: dateRanges FIELDS: dateStart, dateEnd I need to

[SQL] Differences between bit string constant sintax

2009-09-09 Thread Oliveiros C,
the system supposed to behave like this, or have I gone sideways somewhere on this? My copy command is just this : COPY t_unique_browsers ("IDUniqueBrowsers","browsersSet") FROM $file$C:\temp\pg\totalAccount.sql$file$; Also, SELECT version() says : "PostgreSQL 8.3

Re: [SQL] simple (?) join

2009-09-24 Thread Oliveiros C,
You mean to list the complete orders table and for each of its records, the corresponding record on the orders_log with the latest ol_timestamp? SELECT * FROM orders_log main JOIN ( SELECT orders.*, MAX(orders_log.ol_timestamp) as latest FROM orders NATURAL JOIN orders_log GROUP BY orders.* )

Re: [SQL] simple (?) join

2009-09-24 Thread Oliveiros C,
- Original Message - From: "Oliveiros C," To: "Gary Stainburn" ; Sent: Thursday, September 24, 2009 6:17 PM Subject: Re: [SQL] simple (?) join You mean to list the complete orders table and for each of its records, the corresponding record on the orders_log with

Re: [SQL] simple (?) join

2009-09-25 Thread Oliveiros C,
Hello, Justin, Gary. Justin, your (the second one) query is not much different from mine. You previewed the possibility of having orders without any matching entry on orders_log with your left join, something that I haven't. Gary, will you have records on your orders table that don't reference

Re: [SQL] simple (?) join

2009-09-28 Thread Oliveiros C,
Hello, Gary. thank you for your e-mail This is a slightly modified version of the query I sent you on first place (have you tried it out?). It will return (I hope :) the full orders record plus the maximum ol_timestamp and respective o_user. HTH Best, Oliveiros SELECT subquery.*, orders

[SQL] How to order varchar data by word

2009-10-14 Thread Oliveiros C,
Hello, list. I have a table with a varchar field that I would like to order by word, not by ordinal, which seems to be the default on postgres. Does anyone have a clue on how this can be done? Many thanx in advance, Best, Oliveiros

Re: [SQL] How to order varchar data by word

2009-10-19 Thread Oliveiros C,
Oliveiros - Original Message - From: "Adrian Klaver" To: Cc: "Oliveiros C," Sent: Wednesday, October 14, 2009 9:54 PM Subject: Re: [SQL] How to order varchar data by word On Wednesday 14 October 2009 7:13:22 am Oliveiros C, wrote: Hello, list. I have a table wi

Re: [SQL] How to order varchar data by word

2009-10-20 Thread Oliveiros C,
Best, Oliveiros - Original Message - From: "Tom Lane" To: "Oliveiros C," Cc: "Adrian Klaver" ; Sent: Monday, October 19, 2009 6:32 PM Subject: Re: [SQL] How to order varchar data by word "Oliveiros C," writes: If any one can explain me exact

Re: [SQL] How to order varchar data by word

2009-10-20 Thread Oliveiros C,
eiros - Original Message - From: "Adrian Klaver" To: "Oliveiros C," Cc: "Tom Lane" ; Sent: Tuesday, October 20, 2009 2:46 PM Subject: Re: [SQL] How to order varchar data by word On Tuesday 20 October 2009 6:39:23 am Oliveiros C, wrote: Hello, Tom. Thank you fo

Re: [SQL] need nelp with aggregate functions

2009-11-18 Thread Oliveiros C,
Try substituting the SELECT count(c) as qtd_client,count(cm) as qtd_computers by SELECT count( DISTINCT c.cliente_id) as qtd_client,count(/* put here the primary key of the computer table */ ) as qtd_computers Then tell me if it output what you want Best, Oliveiros - Original Message

Re: [SQL] need nelp with aggregate functions

2009-11-19 Thread Oliveiros C,
appearing more than once... It's basically that... Hope this helped Best, Oliveiros - Original Message - From: Another Trad To: Oliveiros C, Cc: pgsql-sql@postgresql.org Sent: Wednesday, November 18, 2009 5:37 PM Subject: Re: [SQL] need nelp with aggregate functions

[SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Oliveiros C,
Dear All, I have a table with host names and some happen to be numeric IPs. I would like to be able to filter out the later. Is there any function pre-defined in the system that can test a particular text type value to see if it is a numeric ip? Something that returns true if applied to '192.1

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Oliveiros C,
depth subjects like pgplsql not to mention regular expressions Thanx a lot for your fast help, Best, Oliveiros - Original Message - From: "Alvaro Herrera" To: "Oliveiros C," Cc: Sent: Friday, December 11, 2009 4:28 PM Subject: Re: [SQL] Is there any functio

Re: [SQL] selecting rows tagged with "a" but not "b"

2010-02-01 Thread Oliveiros C,
Darrell, Can you provide a little more information and background on your problem. please? What values can the "tag" column assume? Just "a" and "b" ? Both? Please give examples of table contents and desired output, your mail doesn't contain enough info to give you more advises Thank you

Re: [SQL] "left join" not working?

2010-02-12 Thread Oliveiros C,
al Message - From: "Louis-David Mitterrand" To: Sent: Friday, February 12, 2010 11:14 AM Subject: [SQL] "left join" not working? Hi, This query: select c.id_currency,max(p.modified_on) from currency c left join price_line p using (id_currency) where p.id_line=1 group by c.

Re: [SQL] "left join" not working?

2010-02-12 Thread Oliveiros C,
- Original Message - From: "Louis-David Mitterrand" To: Sent: Friday, February 12, 2010 11:57 AM Subject: Re: [SQL] "left join" not working? On Fri, Feb 12, 2010 at 11:35:02AM -, Oliveiros C, wrote: My first guess is that NULL fails the condition on your WHERE clause

[SQL] Returning a set of dates

2011-06-10 Thread C. Bensend
Hey folks, I am still slogging away on my pet project, and I'm giving up - I need help from the experts to try to get this function working like I want it to. I have a very basic function, thanks to you guys a few months ago: CREATE OR REPLACE FUNCTION public.next_bill_date(d date, perio

Re: [SQL] Returning a set of dates

2011-06-11 Thread C. Bensend
> http://www.postgresql.org/docs/8.4/interactive/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING > >CREATE OR REPLACE FUNCTION public.next_bill_date(d date, period >interval, > i interval) > RETURNS SETOF date > AS $function$ > DECLARE > max_date date; > due_date date; > BE

Re: [SQL] underscore pattern in a query doens't work

2012-09-13 Thread Sergio C.
Thanks Tom, for your suggestions. We started the cluster up with this command: ./initdb -D /usr/local/postgre/data -E UTF8 -U sir The rest of the variables related to encoding (locale) are: lc_collate=C lc_ctype=C lc_messages=C lc_monetary=C lc_numeric=C lc_time=C Could you tell me which more

[SQL] Time Help

2000-08-22 Thread Brian C. Doyle
Hello all, I have a query result of @ 2 hours 10 mins 6 secs and I would like to change that to 02:10:06. Currently the field is listed as "timespan" This allows me to input date as 02:10:06 or 4h 10m 6s or even 2hrs 10 min 6 sec which are all the formats that I will be entering the time for

Re: [SQL] Time Help

2000-08-22 Thread Brian C. Doyle
g to >convert a "timespan" to a "time". Try adding it to a time like this: >SELECT '0:00:00'::time + '02:10:06'::timespan; > >Mark > >"Brian C. Doyle" wrote: > > > > Hello all, > > > > I have a query result o

Re: [SQL] Time Help

2000-08-22 Thread Brian C. Doyle
:timespan; > > ?column? >-- > 02:10:06 > >Mark > > >"Brian C. Doyle" wrote: > > > > Mark, > > > > On your 7.0 box would you do: > > > > SELECT '0:00:00'::time + '@ 2 hours 10 mins 6 secs':timespan; >

[SQL] Time Results Conversion

2000-08-27 Thread Brian C. Doyle
Hello all, I have now upgraded to 7.0.2 and am very pleased with it. I do have a question about a result that I am getting. When I sum an interval field will get "1 01:01:01" representing "25 hours 1 minute 1 second" The result that I need is just the sum of the hours minutes and se

Re: [SQL] Week of the Year?

2000-09-03 Thread Brian C. Doyle
John, Would you have any clue how to figure out the first saturday of any month - 6 days and the last saturday of that month? I know that this seems odd but i have to run reports for "Non Standard Months" and well I am clueless. At 09:55 PM 8/11/00 -0500, you wrote: >Try using the function d

[SQL] Multiple Index's

2000-09-21 Thread Brian C. Doyle
user_id, date, info where user_id and date are not the same... does that make sense? Brian C. Doyle

Re: [SQL] Multiple Index's

2000-09-21 Thread Brian C. Doyle
See if this help the table has userid | date | helped_customers An employ will enter in their userid, the date and how many customer they helped that day. What I want to do is prevent the employees from enter the data more than once a day At 10:28 AM 9/21/00 -0700, Mitch Vincent wrote: > >

Re: [SQL] Convert from Seconds-Since-Epoch to Timestamp

2000-09-21 Thread Brian C. Doyle
how would you do that with in a query? ie select date , interval(reltime 'table.secs'); when the value in table.secs = 54321 and "secs" is not a part of it? At 11:35 AM 9/21/00 -0700, Jie Liang wrote: >Hi, Webb, > >I am not quit sure what you really want to do, however, I assume that >following

[SQL] Table Attribute Help

2000-10-09 Thread Brian C. Doyle
Hello all, I am trying to find a query to retrive the attributes of a table as in \d tablename but as a select command. Is this possible?

Re: AW: [SQL] Table Attribute Help

2000-10-09 Thread Brian C. Doyle
t; > >-Ursprüngliche Nachricht- >Von: Brian C. Doyle [mailto:[EMAIL PROTECTED]] >Gesendet: Montag, 9. Oktober 2000 17:21 >An: [EMAIL PROTECTED] >Betreff: [SQL] Table Attribute Help > > >Hello all, > >I am trying to find a query to retrive the attributes of a table as in \d >tablename but as a select command. Is this possible?

[SQL] if else query help

2000-10-12 Thread Brian C. Doyle
Hello all, I need to write a query that will pull information from table2 if information in table1 is older then xdate. My laymen example: SELECT table2.date, count(table2.name) as count WHERE table1.startdate > 2 weeks AND table2.submitdate > 2 weeks ; So i Guess my real questions is how do

Re: [SQL] COUNT

2000-10-19 Thread Brian C. Doyle
Hello, You will need to do "SELECT count(attribute) FROM table;" or SELECT count(table.attribute);" At 04:58 AM 10/20/00 +, Craig May wrote: >Hi, > >How do I get a row count, like "Select [COUNT] from Table" ?? > >Regards, >Craig May > >Enth Dimension >http://www.enthdimension.com.au

Re: [SQL] Alternate Database Locations

2000-10-24 Thread Brian C. Doyle
Never mind... I got it working At 02:40 PM 10/24/00 -0400, Brian C. Doyle wrote: >Hello, > >I am working on seting up alternate database locations for my users. >I have done > >% initlocation /home/userid >% createdb -D /home/userid userid > >and i always get > >

[SQL] Alternate Database Locations

2000-10-24 Thread Brian C. Doyle
Hello, I am working on seting up alternate database locations for my users. I have done % initlocation /home/userid % createdb -D /home/userid userid and i always get ERROR: The database path '/home/httpd/jbbent' is invalid. This may be due to a character that is not allowed or because the c

Re: [SQL] Alternate Database Locations

2000-10-25 Thread Brian C. Doyle
out how to get multiple postmasters running on different ports at the same time. Does anyone have any clue how to do that? At 12:04 PM 10/25/00 -0700, Roderick A. Anderson wrote: >On Tue, 24 Oct 2000, Brian C. Doyle wrote: > > > Never mind... I got it working > >OK, don't p

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Brian C. Doyle
sing... I know it must be simple!!! Thanks for all of your help! At 10:43 PM 10/25/00 -0400, Tom Lane wrote: >"Brian C. Doyle" <[EMAIL PROTECTED]> writes: > > I am still trying to find out how to get multiple postmasters running on > > different ports at the same ti

Re: [SQL] Alternate Database Locations

2000-10-26 Thread Brian C. Doyle
pain in the ass but I truly do appreciate all the help At 10:02 AM 10/26/00 -0400, Tom Lane wrote: >"Brian C. Doyle" <[EMAIL PROTECTED]> writes: > > Okay I am still doing something wrong here > > I set PGDATA2=/home/user1/database > > export PGDATA2 > > > th

[SQL] Query Help

2000-12-27 Thread Brian C. Doyle
What do I have to do a query where information in table1 is not in table2 I am looking for something like Select table1.firstname where table1.firstname is not in table2.firstname and table2.date='yesterday' I tried Select table1.firstname where table1.firstname != table2.firstname and table2

Re: [SQL] Query Help

2000-12-28 Thread Brian C. Doyle
Thank you to everyone with their suggestions. Where on the PostgreSQL site would I have found more info on the NOT EXISTS At 11:20 AM 12/27/00 -0500, you wrote: >What do I have to do a query where information in table1 is not in table2 > >I am looking for something like > >Select table1.firs

Re: [SQL] Problem with Day of Week

2001-02-05 Thread Brian C. Doyle
>pmhcc=# select now(); > now > > 2001-01-29 12:57:46-05 >(1 row) > >--- > >Now as far as I know, Sunday is supposed to 1, so I would think that >date_part is doing something funky unless I am mis-understanding >something. I was hoping that someone might be able to shead some light >on this. Thanks. > >Keith C. Perry >VCSN, Inc. >http://vcsn.com

[SQL] Complex Query Help

2001-03-21 Thread Brian C. Doyle
Hello all, I have a table of work shifts. It has Table "teams" Attribute | Type | Modifier +---+-- team_id| varchar(50) | team_name | varchar(100) | location | varchar(100) | department | varchar(100) | shift |

[SQL] Re: enumerating rows

2001-04-13 Thread Luis C. Ferreira
Try this CREATE SEQUENCE just_a_seq; Select nextval('just_a_seq') as row_no, * from pg_tables ; drop SEQUENCE just_a_seq; > > row_no | column1 | column2 | ... > ---+-+-+ ... > 1 | datum11 | datum12 | ... > 2 | datum21 | datum22 | ... >... | ... | ..

Re: [SQL] [HACKERS] why is postgres estimating so badly?

2002-07-18 Thread Nathan C. Burnett
The first thing to point out is that the estimated cost is measured in terms of page reads while the actual time is measured in milliseconds. So even if the cost estimate is accurate it is unlikely that those numbers will be the same. -N -- Nathan C. Burnett Research Assistant, Wisconsin

[SQL] unnecessary updates

2002-10-30 Thread chester c young
When doing database work over the web, especially when many records are on one page, *many* updates get posted to pg that do not change the record. Eg, the page may contain 50 records, the user changes 1, and submits. I assume that a no-change update takes the same resources as a "real" update, i

Re: [SQL] What benefits can I expect from schemas ?

2003-01-08 Thread chester c young
> > I could not find much documentation about SQL 92 schemas that > > 7.3 now supports. I understood it was a structure to group various > > objects, which allows faster privilege management, namespaces > > definition. > > Besides that, I don't see any advantages. I'd be glad if someone > > could p

Re: [SQL] cannot create function that uses variable table name

2003-01-16 Thread chester c young
--- Matthew Nuzum <[EMAIL PROTECTED]> wrote: > I thought I would be crafty and devise a function that would always > return the highest numbered item in the table. But it doesn’t work. > It always gives me a parse error at $1. Here’s the function: build the query as a string and execute it. __

Re: [SQL] Inheritence and Integrity

2003-01-29 Thread chester c young
without oids; -- views for secondary table - generate! create secondary1_v1 as select c.*, s.* from secondary1 s join common c on( s.id1 = c.id ); -- (if you want) dml for view to make life easier - generate! ... if you are maintaining the common info, or if you want a many to one secondary to mas

[SQL] rownum

2003-02-13 Thread chester c young
sorry about this - braindead and cannot find in doc. what's pg's rownum pseudo-column or function name that returns the record number of a set? __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -

[SQL] PL/Pgsql trigger function problem.

2003-02-10 Thread James C. Ousley
  This is suppose to pull all the columns of the table that initiated the trigger func from the sys catalogs, loop through them and put everything that has changed between OLD and NEW into a comma delimited string for input into a log like table for future analysis via middleware (php,perl.

Re: [SQL] Rows as Columns

2003-04-01 Thread chester c young
This is obtuse, but it would work: Have a function that would dynamically build a view that has each of your type names as a column name. It could be triggered by any changes to the types table. The data table would be a left joined onto the customer table for each column. Then select from the

[SQL] Domains and Joins

2003-06-07 Thread chester c young
-- standard setup: create table t1( c1 int primary key, data text ); create domain dom_c1 int references t1 on delete cascade; create table t2( c2 int primary key, c1 dom_c1, moredata text ); -- will not work with "using" create view v1 as select t1.*, t2.moredata from t1 join t2 using( c1 ); --

Re: [SQL] create tables within functions

2003-06-13 Thread chester c young
--- Demidem Mohamed Amine <[EMAIL PROTECTED]> wrote: > hello, > > Can anyone help me create a function that creates a table: create function create_table( text ) returns integer as ' declare p_tab alias for $1; v_exec text; begin v_exec := ''create table '' || p_tab || ''( id integer )'';

[SQL] production parameters

2003-09-13 Thread chester c young
What is the best source doc for postgresql setup in a production environment? I have read - giving it a big chuck of shmem - os not marking data files as accessed or modified but cannot find the doc. thanks, Chester __ Do you Yahoo!? Yahoo! SiteBuilder - Free, eas

[SQL] sorting

2003-09-13 Thread chester c young
how do you set sorting for indicies and order by? is it set once for the database, or can it be set per index? __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ---(end of broadc

[SQL] off subject - pg web hosting

2003-11-08 Thread chester c young
can anybody recomend web hosting that provides postgresql? I have found a couple, but their pricing is several times the going rate using mySql. __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree --

[SQL] Index not recognized

2003-12-05 Thread Grace C. Unson
Hello. Why is it that my index for text[] data type is not recognized by the Planner? I did these steps: 1. create function textarr(text[]) returns text language sql as 'select $1[1]' strict immutable 2. create index org_idx on EmpData (textarr(org)); 3. vacuum full 4. explain analyze select na

Re: [SQL] Rule won't let me NOTIFY, no matter how hard I try

2004-01-15 Thread Luis C. Ferreira
El Mar 13 Ene 2004 18:07, Jeff Boes escribió: >JB: Here's the setup: I wanted to write a rule that would fire on an update >JB: to one table, and do an update to another table, followed by a notify. >JB: My first attempt wasn't acceptable to PG (7.3.4): >JB: >JB: create rule "my_rule" as >JB: on up

Re: [SQL] [PHP] [ADMIN] Data insert

2005-08-22 Thread Jim C. Nasby
r than individual transactions. -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Softwarehttp://pervasive.com512-569-9461 ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your des

Re: [SQL] insert only if conditions are met?

2005-08-31 Thread Jim C. Nasby
Is this possible? > > > > Sure, given a suitable schema > > > > It is not clear to me, if the hours worked are > > to be found in the same table you want to insert > > into, or not. > > > > gnari > > > > > > > > -- Jim C.

Re: [SQL] Help with multistage query

2005-10-04 Thread Jim C. Nasby
lect t1.id from t1, t2 where t1.id = t2.id and t2.id = x > > or more correctly, based on the OP's example: > > select t2.x from t1, t2 where t1.id = t2.id and t1.id = Actually, I think you want AND t2.x , not t1.id. BTW, I recommend not using id as a bareword field name. Very easy

Re: [SQL] Why doesn't the SERIAL data type automatically have a

2005-10-04 Thread Jim C. Nasby
e useful to toss a NOTICE or maybe even WARNING when a serial is created without a unique constraint of some kind? -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.comwork: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512

Re: [SQL] Why doesn't the SERIAL data type automatically have a

2005-10-04 Thread Jim C. Nasby
rry... It I don't think either assertion is true. I'd bet most of the developers actually do normally use an index on a serial, since it's normally used as a PK. And while people can be a bit terse with their replies, I wouldn't say you were blasted. :) -- Jim C. Nasby,

Re: [DOCS] [SQL] Update timestamp on update

2005-10-13 Thread Jim C. Nasby
On Wed, Oct 12, 2005 at 10:52:04PM -0400, Tom Lane wrote: > Jeff Williams <[EMAIL PROTECTED]> writes: > > Thanks. Triggers was my first thought, but chapter 35 on Triggers didn't > > really indicate a way I could do this easily and scared me with a lot of > &g

[SQL] broken join optimization? (8.0)

2005-10-25 Thread chester c young
in php (for example) it's frequently nice to get the structure of a table without any data, ie, pull a single row with each attribute's value is null. I use the query (dual is a table of one row ala Oracle): select m.* from dual left join mytable m on( false ); this works every time, but if myta

Re: [SQL] broken join optimization? (8.0)

2005-10-26 Thread chester c young
> Tom Lane <[EMAIL PROTECTED]> wrote: >> Michael Fuhr <[EMAIL PROTECTED]> writes: > > On Tue, Oct 25, 2005 at 04:56:11PM -0700, chester c young wrote: > >> in php (for example) it's frequently nice to get the structure of > >> table without a

Re: [SQL] broken join optimization? (8.0)

2005-10-26 Thread chester c young
> Tom Lane <[EMAIL PROTECTED]> wrote: > chester c young <[EMAIL PROTECTED]> writes: > > i think i misled: the goal is to retrieve _one_ row where the value > of each attribute is null. > > Er, what for? There's no data content in that, by definition. Wh

Re: [SQL] How to speed up the database query?

2005-10-27 Thread Jim C. Nasby
y time > increased compare to say select a,b from tableA. > > any help, prettymuch appreciated. > > > ---(end of broadcast)--- > TIP 5: don't forget to increase your free space map settings > -- Jim C. Nasby, Sr.

Re: [SQL] why vacuum

2005-10-27 Thread Jim C. Nasby
worthless - it works fine for many > people. But it does have limitations. And you can easily have multi-master syncronous replication in PostgreSQL using the same idea; just see pgCluster. -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software

Re: [SQL] [GENERAL] A Not Join

2005-11-01 Thread Jim C. Nasby
NULL You might have to do the NULL check in a HAVING clause instead... try it. BTW, this is probably better asked on pgsql-sql. -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.comwork: 512-231-6117 vcard: http://jim.nasby.net/pervasive

Re: [SQL] Nested Table in PostgreSQL or some alternative Variants

2005-11-01 Thread Jim C. Nasby
broadcast)--- > TIP 2: Don't 'kill -9' the postmaster > -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.comwork: 512-231-6117 vcard: http://jim.nasby.net/perv

Re: [SQL] Problem with "NOT IN (subquery) - use NOT EXISTS

2005-11-13 Thread chester c young
--- Steve SAUTETNER <[EMAIL PROTECTED]> wrote: > SELECT * FROM famille WHERE famille_code NOT IN > (SELECT DISTINCT famille_mere_famille_code FROM famille);" try select * from famille f1 where not exists (select 1 from famille f2 where f1.famille_code = f2.famille_mere_famille_code); __

[SQL] deferrable on unique

2005-11-22 Thread chester c young
table t1: id integer primary key, seq integer not null unique the seq is for ordering the rows as the user likes. however, if the rows are moved around, eg begin update t1 set seq=4 where id=5 update t1 set seq=5 where id=4 end will bomb because the first update has two rows of seq=4

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-20 Thread Jim C. Nasby
ommand that can do that? > > > > Cluster does that. Vacuum only cleans dead tuples from the tables. > > Note that while reordering, CLUSTER also gets rid of dead tuples, so if > you cluster you don't need to vacuum. It also does a REINDEX... -- Jim C. Nasby, Sr. Engineering C

Re: [SQL] Does VACUUM reorder tables on clustered indices

2005-12-20 Thread Jim C. Nasby
dead tuples, so if > >>you cluster you don't need to vacuum. > > > >It also does a REINDEX... -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.comwork: 512-231-6117 vcard: http://jim.nasb

[SQL] plpgsql triggers in rules

2006-01-01 Thread chester c young
is is possible for to have a "do instead" trigger on a view that is a plpgsql function? __ Yahoo! DSL – Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com ---(end of broadcast)---

[SQL] session variables in 8.0

2006-01-01 Thread chester c young
understand that in 8.0 pg has session variables. cannot find in doc how to use them. __ Yahoo! DSL – Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com ---(end of broadcast)-

[SQL] exceptions in rules

2006-01-01 Thread chester c young
is there any way within a rule to raise an exception? __ Yahoo! for Good - Make a difference this year. http://brand.yahoo.com/cybergivingweek2005/ ---(end of broadcast)--- TIP 4: Have you

[SQL] best way for constants in the database

2006-01-16 Thread chester c young
anybody have a good way to impliment constants in the database? using an immutable pgpgsql function, constant_name() - works, but not necessarily very efficient. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http

Re: [SQL] group by complications

2006-02-13 Thread chester c young
--- Mark Fenbers <[EMAIL PROTECTED]> wrote: > select l.lid,l.fs,max(h.obstime) from location as l > inner join height as h on h.lid = l.lid > where l.fs > 0.0 > group by l.lid,l.fs; > > The above query works as expected in that is fetches the lid, fs and > time of the latest observation in the h

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread chester c young
> Here is my query SQL: > > SELECT key100 FROM ncccr10 > WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9); > > It is is running after 30 minutes. Here is the query plan: > I would try an outer join: select a.key100 from ncccr10 a left join ncccr9 b on( key100 ) where b.key100 is null;

[SQL] grant select,... over schema

2006-02-28 Thread chester c young
is there any way to grant over all applicable objects in a schema, > grant select on schema pop to public; <-- wrong without specifically granting the select on each table? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection

Re: [SQL] grant select,... over schema

2006-02-28 Thread chester c young
do not want to grant ALL PRIVILEGES to user, only SELECT - do not want PUBLIC to have any dml priveleges on this schema --- Michael James <[EMAIL PROTECTED]> wrote: > GRANT ALL PRIVILEGES ON databaseName To username; > > > is there any way to grant over all applicable objects in a schema, > >

  1   2   3   >