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

Re: [SQL] possible bug in psql

2012-05-29 Thread chester c young
> > do not know if right mailing list > > > > in psql in Ubuntu, when beginning with a smaller > terminal, eg, 80 > > col wide, then moving to a larger terminal, eg, 132 col > wide, the > > readline(?) editor in psql still treats like 80 cols, > making it > > impossible to edit longer text.    >

[SQL] possible bug in psql

2012-05-28 Thread chester c young
do not know if right mailing list in psql in Ubuntu, when beginning with a smaller terminal, eg, 80 col wide, then moving to a larger terminal, eg, 132 col wide, the readline(?) editor in psql still treats like 80 cols, making it impossible to edit longer text. -- Sent via pgsql-sql mailing l

Fw: Re: [SQL] pg_dump not correctly saving schema with partitioned tables?

2012-01-31 Thread chester c young
> From: chester c young > Subject: Re: [SQL] pg_dump not correctly saving schema with partitioned > tables? > To: "Tom Lane" > Date: Tuesday, January 31, 2012, 5:40 PM > --- On Tue, 1/31/12, Tom Lane > wrote: > > > From: Tom Lane > > Subject:

[SQL] pg_dump not correctly saving schema with partitioned tables?

2012-01-31 Thread chester c young
have database with many partitions. each partition table has its own primary key sequence. Column || Modifiers ---++-- uno_id|| not null default nextval('cmp0004.cmt_u

[SQL] partitions versus databases

2011-12-08 Thread chester c young
have an db with about 15 tables that will handle many companies. no data overlap between companies. is it more efficient run-time to use one database and index each row by company id, and one database and partition each table by company id, or to create a database for each company? it is a we

Re: [SQL] best performance for simple dml

2011-06-27 Thread chester c young
it's a very cool paradigm, but is it actually a good idea? --- On Mon, 6/27/11, Pavel Stehule wrote: From: Pavel Stehule Subject: Re: [SQL] best performance for simple dml To: "chester c young" Cc: pgsql-sql@postgresql.org Date: Monday, June 27, 2011, 1:05 AM 2011/6/27 ches

Re: [SQL] best performance for simple dml

2011-06-27 Thread chester c young
very nice pointers.  thank you very much! --- On Mon, 6/27/11, Pavel Stehule wrote: From: Pavel Stehule Subject: Re: [SQL] best performance for simple dml To: "chester c young" Cc: pgsql-sql@postgresql.org Date: Monday, June 27, 2011, 1:05 AM 2011/6/27 chester c young > > tw

Re: [SQL] best performance for simple dml

2011-06-26 Thread chester c young
: "chester c young" Cc: pgsql-sql@postgresql.org Date: Monday, June 27, 2011, 12:35 AM Hello try it and you will see. Depends on network speed, hw speed. But the most fast is using a COPY API http://www.postgresql.org/docs/9.0/interactive/libpq-copy.html Regards Pavel Stehule 2011/6/

[SQL] best performance for simple dml

2011-06-26 Thread chester c young
what is the best performance / best practices for frequently-used simple dml, for example, an insert 1. fast-interface 2. prepared statement calling "insert ..." with binary parameters 3. prepared statement calling "myfunc(..." with binary parameters; myfunc takes its arguments and performs an in

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

[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] "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

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] 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] 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

[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] 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

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] 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] 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-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

[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] 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

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-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-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.* )

[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] how to tell if column set on update

2009-07-21 Thread chester c young
> Le 20/07/09 15:19, chester c young a écrit : > > within a trigger need to know if the UPDATE statement > set a column.  the column might be set to the old value > or a different value. > > > > (want to make sure the app is sending all necessary > values) > >

[SQL] unused columns in copy

2009-07-20 Thread chester c young
is there a way for COPY FROM to ignore unused columns in CSV? in other words, if table t1 has columns c1, c2, and if csv has columns c1, c3, c2, could I do something like COPY t1( c1, null, c2 ) FROM 'file.csv' -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make cha

[SQL] how to tell if column set on update

2009-07-20 Thread chester c young
within a trigger need to know if the UPDATE statement set a column. the column might be set to the old value or a different value. (want to make sure the app is sending all necessary values) thanks -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to yo

[SQL] do unneeded outer joins cost?

2009-06-05 Thread chester c young
for example: selectt1.* from t1 left join t2 on( ); since t2 is not used in the result nor is it used in determining the result, is the to left join t2 used? (the question goes as to how much generated sql needs to be cleaned to be efficient) -- Sent via pgsql-sql maili

[SQL]

2009-03-05 Thread Jhonny Velasquez c .
hola a todos estoy programando en php tengo el siguiente esquema de BD BDACADEMICA personas(idpersona, nombres, paterno) BDSIAP PersonasDatosActualizables(idpersona, direccion, telefono) son dos bases de datos, de las cuales mediante una sola consulta quiero unir los datos de l

[SQL] uso de dblink en php

2009-03-05 Thread Jhonny Velasquez c .
hola a todos estoy programando en php tengo el siguiente esquema de BD BDACADEMICA personas(idpersona, nombres, paterno) BDSIAP PersonasDatosActualizables(idpersona, direccion, telefono) son dos bases de datos, de las cuales mediante una sola consulta quiero unir los datos de l

Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-27 Thread chester c young
> > 2. perhaps "global" could mean simply that > the definition is global - if called for session and not > exist in session, then session prepares it first from the > global def. there would need to be a back reference in > case the global def was changed or dropped. > > > > Yes, this seems to

Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-25 Thread chester c young
1. like the idea because right now I'm having to track which prepared statement (sets) are in which session. using xcache to track this, but little bit dangerous. could query the database first but the whole idea is to take a load off the db. 2. perhaps "global" could mean simply that the def

Re: [SQL] SQL question....

2008-05-20 Thread chester c young
> create table access (name text, address ip) > > I want to construct a SELECT statement which will return ONLY tuples > containing IP and name pairs IF there is an IP that has two or more > NAMEs associated with it. > > many ways: select a1.* from access a1 where exists( select 1 from ac

Re: [SQL] Difference in columns

2008-05-11 Thread chester c young
--- Mag Gam <[EMAIL PROTECTED]> wrote: > Hi All, > > I have a view that generates output similar to this. > > select * from foo.view; > >ts | size > ---+- > 2002-03-16| 11 > 2002-03-17| 16 > 2002-03-18| 18 > 2002-03-19| 1

Re: [SQL] numbering rows on import from file

2008-05-02 Thread chester c young
--- Alexy Khrabrov <[EMAIL PROTECTED]> wrote: > Now I want to number the rows, adding an id column > as an autoincrement from a sequence. How should I do the import now > for the sequence to work -- should I add the id column last, so it > will not be filled by copy and presumably autoincrem

Re: [SQL] columns for count histograms of values

2008-04-30 Thread chester c young
--- Alexy Khrabrov <[EMAIL PROTECTED]> wrote: > Greetings -- I have a table of the kind > > Ratings: > id integer > rating smallint > > -- where value can take any value in the range 1 to 5. Now I want to > > have a statistical table Stats of the form > > id integer > min smallint > max sma

Re: [SQL] psql: no schema info

2008-04-28 Thread chester c young
> > # \dt table1 -> does not show which schema info. was wrong on this - \dt shows schema for relations _not_ in the search path. my new good practice is to keep search_path = PUBLIC so all schema info is displayed always all the time invariably.

Re: [SQL] psql: no schema info

2008-04-27 Thread chester c young
> > however, just got burnt big time on sequences! need to qualify > them as > > well, eg > > col1 integer default nextval( 'schema1.seq1' ) > > Move to something newer than 8.0.x, and this is automatic (because > nextval's argument is actually a regclass constant). > >

[SQL] psql: no schema info

2008-04-27 Thread chester c young
have several schemae, each with identical tables. in create scripts have been taking great care to fully qualify, eg, col1 references schema1.tab1( col1 ) however, just got burnt big time on sequences! need to qualify them as well, eg col1 integer default nextval( 'schema1.seq1' ) \dt is no

Re: [SQL] trim(both) problem?

2008-04-25 Thread chester c young
--- Emi Lu <[EMAIL PROTECTED]> wrote: > Isn't this a bug about trim both. > > select trim(both '' from 'ROI Engineering Inc.'); > btrim > - > OI Engineering Inc. > (1 row) > > > "R" is missing? How? you misread - '' argument is a list of characters, _not_ a st

Re: [SQL] apparent RI bug

2008-04-03 Thread chester c young
--- Stephan Szabo <[EMAIL PROTECTED]> wrote: > > is it is possible, for example, a function without a body or > without a "return old". > > > > are you saying this would override the RI constraint? > > If it returned something that would have prevented the delete without > an error, yes. this is

Re: [SQL] apparent RI bug

2008-04-03 Thread chester c young
--- Stephan Szabo <[EMAIL PROTECTED]> wrote: > Is it possible you ever had a before delete trigger that just did a > return > NULL rather than raising an exception? IIRC, explicitly telling the > system to ignore the delete will work on the referential actions. yes, it is possible, for example, a

Re: [SQL] apparent RI bug

2008-04-03 Thread chester c young
Stephan Szabo <[EMAIL PROTECTED]> wrote: > On Wed, 2 Apr 2008, chester c young wrote: > > > it appears I have a broken RI in my db. > Yeah, that looks pretty broken. Can you reproduce this from a clean > start repeatedly or is this a one off? Do you ever turn of

[SQL] apparent RI bug

2008-04-02 Thread chester c young
it appears I have a broken RI in my db. call_individual.clh_id references call_household.clh_id \d call_individual ... Foreign-key constraints: "call_individual_clh_id_fkey" FOREIGN KEY (clh_id) REFERENCES call_household(clh_id) ON DELETE CASCADE however: development=# select clh_id from cal

[SQL] returning on inserts

2008-03-27 Thread chester c young
insert into t1( c1 ) select c1 from t2 returning t1.c1, t2.c2; ERROR: missing FROM-clause entry for table "t2" is there any way to make this work? Never miss a thing. Make Yahoo your home page. http://

Re: [SQL] Date and filling issues

2008-03-20 Thread chester c young
> > A sample of the current results data would be like > datesales > 2008-03-07 100.00 > 2007-03-10 150.00 > 2007-03-18 50.00 > > and what I'm trying to do is fill in the missing dates with sales > values of 0. what I do is have a table called days t

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread chester c young
> When inserting a record is there a way to have postgres create a > random number for a field such that it is unique? you could use oid Looking for last minute shopping deals? Find them fast with Ya

[SQL] cursors and sessions

2008-03-13 Thread chester c young
is there any way to share a cursor between sessions? I have a costly query whose records need to be visited by in order by n number of concurrent sessions, and am unable to find the best way of doing this. I'd almost like to write a daemon that hands out the next record, but that's a royal pain t

Re: [SQL] Proposed archival read only trigger on rows - prevent history modification

2008-01-28 Thread chester c young
> I'm considering building a protective mechanism, and am seeking > feedback > on the idea. The approach would be to add a new column named "ro" to > each table at invoice level and below. Then have a trigger on > 'ro'==true deny the write, and probably raise a huge stink. As > invoice > are ma

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,

Re: [SQL] Advice for generalizing trigger functions

2007-12-26 Thread chester c young
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > I've created quite a few functions that log modifications to various > history tables. (the history table has the same name as the base > table but is prefixed by the 'History.' schema.) The only difference > between functions I can find is the

Re: [SQL] update on join ?

2007-11-21 Thread chester c young
> I tried > > UPDATE things JOIN inventory ON things.thing_id = inventory.thing_fk > SET number = 0 > WHERE color = 'red' > use the cool "from" clause in the update update things t set number = 0 from inventory i where t.thing_id = i.thing_fk and i.color = 'red'; _

[SQL] general question on optimizer

2007-11-10 Thread chester c young
I have found that in many complex queries left join is exponentially faster than a (not) exists clause. I don't understand why, generally speaking, this is so frequently so effective. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam

[SQL] backup database tablespace with rsync?

2007-10-19 Thread chester c young
postgres A, db 'test', tablespace /pg/test1 postgres B, db 'test', tablespace /pg/test2 tablespace /pg/test1 only has A db 'test' tablespace /pg/test2 only has B db 'test' if - A and B shut down - /pg/test1 copied to /pg/test2 - A and B restarted would B db 'test' be running the data that was in

[SQL] problems with copy

2007-09-24 Thread chester c young
I'm getting lots of delimited files from Excel and MySQL users that, mid-file, begin truncating lines if ending in null values. for example: 1781: "one","two","three",, 1782: "one","two","three",, 1783: "one","two","three",, (delimited files from Open Office are well behaved) is there any wa

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread chester c young
> And what I'd like is something that would give me the counts for the > number of occurrences of each unique hostname. Something much like > `uniq -c'. Can anyone tell me how that's done or where I should look > for info? (I'm not sure what to look for,

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread chester c young
> >> I'm trying to use substr() and position() functions to extract the > >> full host name (and later a domain) from a column that holds URLs. > > > > substring( href from '.*://\([^/]*)' ); > > typo: no backslash in front of left paren substring( href from '.*://([^/]*)' ) match up thru // wi

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread chester c young
> I'm trying to use substr() and position() functions to extract the > full host name (and later a domain) from a column that holds URLs. substring( href from '.*://\([^/]*)' ); Pinpoint customers who a

Re: [SQL] Execute SQL statements with 'context'/predefined variables

2007-09-03 Thread chester c young
... > When you say use rules to inject constants, how would I go about > doing this? Could you maybe give a brief example? create view tab1_dml as select * from tab1; -- note: -- CONSTANT1 = 8 -- CONSTANT2 = 15 create or replace rule tab1_insert as on insert to tab1_dml do instead( ins

Re: [SQL] Execute SQL statements with 'context'/predefined variables

2007-09-03 Thread chester c young
> I was wondering if it is possible to set the 'context' for running an > sql command Oracle has a Context('varname') that returns the value of varname for the session. to best of my knowledge pg has nothing like this. > I guess bottom line, is it possible to execute a bunch of SQL > statements

Re: [SQL] Comparing two slices within one table efficiently

2007-08-13 Thread chester c young
> I have a table with the following simplified form: > > create table t ( > run_id integer, > domain_id integer, > mta_id integer, > attribute1 integer, > attribute2 integer, > unique(run_id, domain_id, mta_id) > ); > > The table has about 1 million rows with run_id=1, another 1 million >

Re: [SQL] Authentification failed

2007-08-01 Thread chester c young
> I'm trying in SUSE to connect to a postgres db and this is the > error: > > Ident Authentification failed for user <> > others will guide better, but for now, in pg_hba.conf # "local" is for Unix domain socket connections only local all all iden

[SQL] problem join

2007-07-26 Thread chester c young
having problem joining these correctly: schedule - cal_id references calendar not null - usr_id references users not null = unique( calZ_id, usr_id ) - result_no not null activity - cal_id references calendar not null - usr_id references users not null = unique( cal_id, usr_id ) - from_ts timesta

Re: [SQL] Assistance with a trigger

2007-07-25 Thread chester c young
--- Paul Lambert <[EMAIL PROTECTED]> wrote: > I have some triggers in an MS SQL server database which I need to > copy > across to a PG database. I've not yet done triggers in PG so I was > hoping to get a little bit of a pointer on the first one as a place > to > start and work my way through

Re: [SQL] data dependent sequences?

2007-07-15 Thread chester c young
> > CREATE TABLE items ( > id INT, > typ INT... > PRIMAY KEY (seq,typ)); > >id typ > +- > 1 'a' > 2 'a' > 3 'a' > 1 'b' > 4 'a' > 2 'b' > you will need to use pre insert trigger since you cannot use column references in defaul

Re: [SQL] Converting from MS Access field aliases

2007-07-12 Thread chester c young
>SELECT field1 / 2 AS foo, > field2 * 2 AS bar, > foo + bar AS total >WHERE foo < 12; > > The first two fields are fine, it's the third that's a problem. The > database reports > >ERROR: column "foo" does not exist > First, I think it would be great if this w

Re: [SQL] Iterate and write a previous row to a temp table?

2007-07-03 Thread chester c young
--- Bob Singleton <[EMAIL PROTECTED]> wrote: > Revisiting a Time In Status query I received help on - I'm trying to > narrow down a subset of data I return for analysis. > > Given a statusLog as entityId, statusId, timestamp that might look > something like > > entityId | statusId | timestamp

Re: [SQL] trigger firing order

2007-06-15 Thread chester c young
> > does the post trigger on A wait until post trigger on B is > executed? -> > this seems intuitive to me. > > How can it wait until the trigger on B is executed if the trigger on > B doesn't > actually get triggered until someone updates B and it's the trigger > on A > doing the update? trigge

[SQL] trigger firing order

2007-06-15 Thread chester c young
tables A and B: a post row trigger on A cause updates on B which has its own post row trigger. does the post trigger on A wait until post trigger on B is executed? - this seems intuitive to me. does the post trigger on B wait until the trigger on A has completed? or is post trigger A launched as

[SQL] search path within trigger

2007-06-09 Thread chester c young
within a table pl/pgsql trigger, what's the easiest way to see if the schema for the triggered table is the same as search_path? Be a better Globetrotter. Get better travel answers from someone who knows.

[SQL] schema propagation

2007-06-01 Thread chester c young
Hi has anyone done any work on comparing schemas? I'm trying to automatically propagate changes in a master schema to child schemas. All schema changes will originate at master. Currently child schemas are in the same database, but in the future might be in different databases (clusters?). tha

[SQL] off topic

2007-05-24 Thread chester c young
on lwn I read that pg is having problems releasing because of a want of reviewers. although my C is far too rusty I'd like to help out, perhaps with doc or testing. can someone direct me to the appropriate

Re: [SQL] ignoring primary key violations in COPY command

2007-05-19 Thread chester c young
> In my opinion your best bet in terms of getting around the primary > key > violation is to create a temporary table ... good idea! from my experience it's almost always best to pull raw info into a buffer table before introducing it into the real world. ___

Re: [SQL] Adding "on delete cascade" to all foreign key constraints

2007-05-15 Thread Jim C. Nasby
On Tue, May 15, 2007 at 12:19:54PM -0500, Peter Hanson wrote: > Hello, > > I was wondering if there's a fast way I can add "on delete cascade" to all > foreign key constraints in my database? Maybe a quick update I can make > against the catalog possibly? Or is there a way I can query for all f

Re: [SQL] Count rows by day interval

2007-05-10 Thread chester c young
> ... instead of date_trunc('day',sent_messages.date) why don't you have a function that takes four three arguments: - beginning date of query - interval, ie, reminder_services.activity_days_min - timestamp, ie, sent_messages.date have it return the minimum date for that interval as I think I u

Re: [SQL] Selecting rows with "static" ordering

2007-04-26 Thread chester c young
> them in the order they are currently stored in that variable. So take > > for example this foreign application variable: > >ids = "3,2,5,1,4" kludgy, but: 1. store your ids in a pg array 2. select from the array 3. on order by, write a function that takes the row.id and array as paramet

Re: [SQL] Large journal as psql table. Good idea? Triggering.

2007-04-23 Thread chester c young
> But I'm thinking that maybe it's a job for a database table. Each > new > row would be written with a status (10="new"). And that the modem > process would poll for new rows. Problem is there will be lots of > rows, > but only a trivial few will be "new". The huge index file and the > pollin

Re: [SQL] Foreign Unique Constraint

2007-03-27 Thread chester c young
> > create table table1 ( > id SERIAL PRIMARY KEY > extension UNIQUE, > > ) > > create table table2 ( > id SERIAL PRIMARY KEY > extension UNIQUE, > > ) > > Basically table 1 and table 2 both have the concept of an extension > that must be unique but the rest of the info in the tables are > di

[SQL] better approach: case or join

2007-03-18 Thread chester c young
from id extracting name from several tables. which is generally the better approach? select case when tab_tla='usr' then (select name from users where ... ) case when tab_tla='con' then (select title from contents where ...) endas name; as versus select name fromusers where ta

[SQL] how to use a date range in a join

2007-03-12 Thread chester c young
trying to do something like select d.day, c.name from [dates between day1 and day2] d left join c.some_table; but cannot figure out what to put into the brackets. Finding fabulous fare

Re: [SQL] inheritance

2007-03-08 Thread chester c young
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > > > > Maybe then you'll add a table basket that has a foreign key to the > fruit > > table... ;-) > > From the inheritance link: > ... > A serious limitation of the inheritance feature is that ... it's my understanding that inheritance h

Re: [SQL] inheritance

2007-03-08 Thread chester c young
> --- Greg Toombs <[EMAIL PROTECTED]> wrote: > > > I'm trying to figure out how to nicely implement a C++ class-likesystem > > with PostgreSQL. Consider the following: > > Tables Fruit, Apple, Orange you can do this traditionally or through pg inheritance, alt

Re: [SQL] simple web search

2007-02-23 Thread chester c young
> > create view search_v as select > > 'show'::name as tab_nm, > > show_id as tab_pk, > > 'Show Name' as description, > > show_name as search > > from show > > union select > > 'story'::name, > > story_id, > > 'Story Title', > > title > > from story > > union ... > > > What

Re: [SQL] simple web search

2007-02-23 Thread chester c young
> I'm considering implementing a search box on my review web site > http://lesculturelles.net and am looking for a simple way to match > entered words against several columns on related tables: > show.show_name, story.title, person.firtname, person.lastname, etc. one solution would be a view: c

Re: [HACKERS] timestamp subtraction (was Re: [SQL] formatting intervals with to_char)

2007-02-23 Thread Jim C. Nasby
Yes, but if it was '2004-01-02 01:00:00'-'2004-01-01 00:00:00' it should return 25:00:00, not 1 day 1:00. I agree with Tom that this should be changed; I'm just arguing that we might well need a backwards-compatibility solution for a while. At the very least we'd need to make this change very clea

Re: [SQL] Query to return schema/table/columname/columntype

2007-01-19 Thread chester c young
> I am trying to modify the dabo (a python wxpython > ide for database forms creation) code to allow the > selection of tables in any schema. I need a query > that will return records with schema, table, > columname and columne type. create view pg_cols as select s.nspname as schema_nm,

[SQL] quoted variables in pgsql

2007-01-04 Thread chester c young
cannot figure this out # \set var 'value' # select * from some_table where some_col = :var; ERROR: column value does not exist cannot get those quotes around the value. tried: # \set var ''value'' # \set var value in each case: # \echo :var value thanks ___

Re: [SQL] or function

2006-12-30 Thread chester c young
--- "A. R. Van Hook" <[EMAIL PROTECTED]> wrote: > I have been trying to do an 'or' function such that if a field value > is > zero then use 1 as a multiplier: > "select sum((1 | i.count) * s.cost) as COST ... try "select sum( (case when i.count=0 then 1 else i.count end) * s.cost ) as COST ...

Re: [SQL] [ADMIN] Is there anyway to...

2006-11-07 Thread Jim C. Nasby
Moving to -general (and please start a new thread instead of hijacking an existing one). On Thu, Nov 02, 2006 at 01:14:22PM -0500, louis gonzales wrote: > Hello all, > Is there an existing mechanism is postgresql that can automatically > increment/decrement on a daily basis w/out user interaction

Re: [SQL] Add calculated fields from one table to other table

2006-10-28 Thread chester c young
roopa perumalraja <[EMAIL PROTECTED]> wrote: Hi   I have two tables. Tick table has fields like ticker, time, price & volume and Timeseries table has fields like ticker, time, avg_price, avg_volume.   The time field in Timeseries table is different from time in tick table, its the timeseries fo

Re: [SQL] Can we convert from Postgres to Oracle !!???

2006-10-26 Thread Jim C. Nasby
On Sun, Oct 22, 2006 at 12:03:38AM +0300, Devrim GUNDUZ wrote: > On Tue, 2006-10-17 at 14:21 +0530, Sandeep Kumar Jakkaraju wrote: > > Can we convert from Postgres to Oracle !!??? You can also run our software and get Oracle syntax for 1/25th the cost. -- Jim Nasby

Re: [SQL] delete on cascade

2006-10-23 Thread chester c young
--- Luca Ferrari <[EMAIL PROTECTED]> wrote: > Hi all, > I guess this is an already asked question, but I didn't found an > answer, so > apologize me. Imagine I've got two tables: > skill(id,description) // primary key => id > family(id,description)// primary key => id > and I want

Re: [SQL] Grouping by day, limiting amounts

2006-10-19 Thread Jim C. Nasby
On Thu, Oct 19, 2006 at 01:51:55PM +0200, Mezei Zolt??n wrote: > > Hi, > I didn't really know what subject I should give. > I have a table like this one: > 2006.10.01.Bela10 > 2006.10.01.Aladar9 > 2006.10.01.Cecil8 > 2006.10.01.Dezso7 > 2006.10.01.Elemer6 >

Re: [SQL] [HACKERS] Bug?

2006-10-19 Thread Jim C. Nasby
See section 9.12 of the docs. On Thu, Oct 19, 2006 at 12:28:58PM +0530, Indira Muthuswamy wrote: > Then how do we clear the values of a serial column(is it done only by > dropping the column?)? > > Regards, > M.Indira > > > > On 10/19/06, Jim C. Nasby <[EMAIL PR

Re: [SQL] hi i want help on levels

2006-10-18 Thread Jim C. Nasby
Search the archives for hierarchical query. -- Jim Nasby[EMAIL PROTECTED] EnterpriseDB http://enterprisedb.com 512.569.9461 (cell) ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] [HACKERS] Bug?

2006-10-18 Thread Jim C. Nasby
Moving to -sql. On Wed, Oct 18, 2006 at 06:53:46PM +0530, Indira Muthuswamy wrote: > Hai, > > I have encountered a problem with PostgreSQL.I have created a table > 'tab1' with a column 'a' with serial type.I entered 20 records into the > table.So the query > select max(a) from tab1; > returned 2

  1   2   3   >