Re: [SQL] Restrict FOREIGN KEY to a part of the referenced table

2013-04-12 Thread Richard Broersma
Your explanation goes here.; If you need to hide this column from you uses, you can use a view. -- Regards, Richard Broersma Jr.

Re: [SQL] Disabling constraint check

2012-09-17 Thread Richard Broersma
disable a check constraint. Perhaps a staging table is advisable here? -- Regards, Richard Broersma Jr.

Re: [SQL] updating a sequence

2011-11-15 Thread Richard Broersma
-- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] need help with some aggregation magic

2011-06-09 Thread Richard Broersma
, project_id, date_trunc( 'day', ts ) ORDER BY date_trunc( 'day', ts ), user_id, project_id; -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Richard Broersma
* FROM Yourtable AS B WHERE B.id = A.id AND B.ts A.ts - INTERVAL '5 MINUTES' AND B.tx A.ts ) ORDER BY id, ts; -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread Richard Broersma
= Accum_ts.id AND B.ts = Accum_ts.ts - INTERVAL '5 MINUTES' GROUP BY B.id HAVING MIN( B.ts ) = MAX( B.ts )) SELECT id, ts FROM Accum_ts ORDER BY id, ts; -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] Dates and NULL's`

2011-05-10 Thread Richard Broersma
= SELECT (NULL::DATE = '2011-04-01'::DATE AND NULL::DATE = '2011-04-30'::DATE) IS UNKNOWN; ?column? -- t (1 row) -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

Re: [SQL] Dates and NULL's`

2011-05-10 Thread Richard Broersma
is the arguments all evaluate to TRUE. No rows will be returned for rows that cause the WHERE clause to evaluate to a NULL value. -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

[SQL] None numeric exclusion constraints using GIST

2011-05-06 Thread Richard Broersma
/docs/9.1/static/datatype-geometric.html http://www.postgresql.org/docs/9.1/static/sql-createindex.html http://www.depesz.com/index.php/2010/01/03/waiting-for-8-5-exclusion-constraints/ Is this correct? -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org

Re: [SQL] concatenate question

2010-12-07 Thread Richard Broersma
On Tue, Dec 7, 2010 at 1:47 PM, Tony Capobianco tcapobia...@prospectiv.com wrote: Why did I need to cast both as text though? http://www.postgresql.org/docs/8.3/interactive/release-8-3.html#AEN87134 -- Regards, Richard Broersma Jr. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org

Re: [SQL] force view column varchar(32) to varchar(128)

2010-11-19 Thread Richard Broersma
data to the new schema. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Using PL/pgSQL text argument in 'IN (INT,INT,...)' clause [re-post]

2010-10-25 Thread Richard Broersma
should work: UPDATE foo Set x = y WHERE id = ANY( CAST( string_to_array( '1,2,3,4', ',' ) AS INTEGER[] )); -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] Domains, casts, and MS Access

2010-08-04 Thread Richard Broersma
instead of 't' and 'f'. For the sake of compatibility (especially bareword integers in queries), I've defined a 'sybit' type in postgres to be a domain. One thought would be see if ODBC configuration options will achieve this for you. Have you already exhausted this option? -- Regards, Richard

Re: [SQL] Domains, casts, and MS Access

2010-08-04 Thread Richard Broersma
could find. I know that there are a couple of options that affect the representation of Booleans in the odbc driver. I'm not sure it will do what you need though. However, here is the official documentation: (hopefully it helpful) http://psqlodbc.projects.postgresql.org/ -- Regards, Richard

Re: [SQL] Domains, casts, and MS Access

2010-08-04 Thread Richard Broersma
PDTSTATEMENT: BEGIN; UPDATE public.structures SET scoped=E'-1' WHERE buildingfunction = E'CRANE OPERATOR STATION' AND xmin = 20497 -06-08 14:39:43 PDTLOG: duration: 0.000 ms statement: ROLLBACK -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] Delete rules

2010-08-04 Thread Richard Broersma
hard to get correct. They sometimes do unexpected things. It looks like the CREATE Trigger FOR EACH STATEMENT is better suited to do what you want: In addition, triggers may be defined to fire for a TRUNCATE, though only FOR EACH STATEMENT. -- Regards, Richard Broersma Jr. Visit the Los Angeles

Re: [SQL] Domains, casts, and MS Access

2010-08-04 Thread Richard Broersma
, does any better? From my limited experience, I believe is does do better. The following blogs as a few entries about using Base: http://www.postgresonline.com/journal/archives/167-Importing-data-into-PostgreSQL-using-Open-Office-Base-3.2.html -- Regards, Richard Broersma Jr. Visit the Los

Re: [SQL] what does this do

2010-06-10 Thread Richard Broersma
has a give-away that this is a set returning function: jfcs_balancedue('%s') since it has a parameter. Notice the function name section taken from the from clause: http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-FROM -- Regards, Richard Broersma Jr. Visit the Los Angeles

Re: [SQL]

2010-05-21 Thread Richard Broersma
with the newly discovered itemnbr. */ 2010-05-21 07:28:38 PDTLOG: statement: SELECT itemnbr,action,startdate,completiondate FROM public.actionitems WHERE itemnbr = 49 -- Regards, Richard Broersma Jr. Visit the Los Angeles

Re: [SQL]

2010-05-20 Thread Richard Broersma
in recent versions auto increment is recognized by MS-Access just fine (I'm guessing this is due to the Return clause which the ODBC driver automatically calls). -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Richard Broersma
:= 'CURRENT_DATE';    LOOP I'm not up on my pl/pgSQL, but isn't CURRENT_DATE a literal value so it shouldn't to be enclosed in single quotes? Another idea would be to: CAST( now() AS DATE ) -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] Greetings folks, dumb question maybe?

2010-05-12 Thread Richard Broersma
( WHERE n = 1) p2082849b- SELECT n,c,d FROM T; INSERT 0 10001 -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http

[SQL] Celko take on EAV

2010-05-07 Thread Richard Broersma
to? -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] graphing time series data

2010-04-14 Thread Richard Broersma
, opendays WHERE opendays.day = ds.discstartdt AND opendays.day = LEAST('now'::text::date, ds.resolutiondate) GROUP BY opendays.day, ds.resolvingparty ORDER BY opendays.day, ds.resolvingparty; -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread Richard Broersma
constraints. While 8.4 has CTE's which are good for querying adjacency list tree, we need to wait for write-able CTE's (maybe 9.1?) to preform all of the possible tree modifications. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] check constraint on multiple tables?

2010-03-03 Thread Richard Broersma
, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] check constraint on multiple tables?

2010-03-03 Thread Richard Broersma
. Each cabin is defined by a category according the set in the cabin_category table. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your

Re: [SQL] check constraint on multiple tables?

2010-03-03 Thread Richard Broersma
overlap, this is an indication of a violation of the second normal form (I believe). -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your

Re: [SQL] Fwd: conditional rule not applied

2010-01-06 Thread Richard Broersma
the results from a *single* base table. Having said all of this, it is possible to do what your describing. I've seen Keith Larson make update-able views from a composite of selected UNION and FULL OUT JOIN queries. But his solution was extremely hackish. -- Regards, Richard Broersma Jr. Visit

[SQL] CREATE SERVER - what is this?

2009-11-24 Thread Richard Broersma
I noticed a few new SQL references in the manual: CREATE SERVER CREATE FOREIGN DATA WRAPPER, CREATE USER MAPPING Is this similar to DBI-Link? -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing

Re: [SQL] ORDB and dot-notation query

2009-11-10 Thread Richard Broersma
have some problem and how to fix this? Are you sure that you didn't just misspell address? -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes

[SQL] Learning about WITH RECURSIVE

2009-11-04 Thread Richard Broersma
-- 5050 (1 row) broersr= WITH RECURSIVE t(n) AS ( broersr( VALUES (1) broersr( UNION ALL broersr( SELECT n+1 FROM t WHERE n 100 broersr( ) broersr- SELECT sum(n) FROM t; sum -- 5050 (1 row) -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] Learning about WITH RECURSIVE

2009-11-04 Thread Richard Broersma
On Wed, Nov 4, 2009 at 2:11 PM, Tom Lane t...@sss.pgh.pa.us wrote: Richard Broersma richard.broer...@gmail.com writes: Can anyone one explain why a WITH RECURSIVE query has the same results regardless whether UNION or UNION ALL is specified? Well, if the rows are all different anyway, UNION

Re: [SQL] Learning about WITH RECURSIVE

2009-11-04 Thread Richard Broersma
On Wed, Nov 4, 2009 at 2:11 PM, Tom Lane t...@sss.pgh.pa.us wrote: Richard Broersma richard.broer...@gmail.com writes: Can anyone one explain why a WITH RECURSIVE query has the same results regardless whether UNION or UNION ALL is specified? Well, if the rows are all different anyway, UNION

Re: [SQL] left outer join on more than 2 tables?

2009-06-16 Thread Richard Broersma
for? SELECT R.region_name, Count(*) AS RegionComplaints FROM Region AS R LEFT JOIN City AS Ci ON R.id = C.region_id LEFT JOIN Complaint AS Cm ON Ci.id = Cm.city_id GROUP BY R.region_name; -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] left outer join on more than 2 tables?

2009-06-16 Thread Richard Broersma
; SELECT    R.region_name,    Count(*) AS RegionComplaints FROM    Region AS R        LEFT JOIN City AS Ci            LEFT JOIN Complaint AS Cm ON Ci.id = Cm.city_id      ON R.id = C.region_id GROUP BY    R.region_name; Yup, it produces the same result. -- Regards, Richard Broersma Jr

Re: [SQL] left outer join on more than 2 tables?

2009-06-16 Thread Richard Broersma
(*) more since it helps to correctly express the idea that we are counting rows per group and not cm.id(s) per group. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] left outer join on more than 2 tables? (UNCLASSIFIED)

2009-06-16 Thread Richard Broersma
(other flavors are available also). -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

Re: [SQL] Type inheritance

2009-06-06 Thread Richard Broersma
EAV for a column instead of a table. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Richard Broersma
unless the foreign key is set with ON UPDATE CASCADE then the shifts will be cascaded to all references automatically. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org

Re: [SQL] changing multiple pk's in one update

2009-04-13 Thread Richard Broersma
common solution is to use optimistic locking, another solution that I know of is to use serialized transaction isolation. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] Problem inserting image

2008-12-22 Thread Richard Broersma
is an example how how ADODB.Stream class work in conjunction with ADODB.command prepared statements to push binary data into a field. The same should work with PostgreSQL. http://www.databasedevelopment.co.uk/examples/StoredBlobs.zip -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL

Re: [SQL] Best way to restrict detail rows?

2008-12-08 Thread Richard Broersma
can update the data with copy, and otherwise not touch it. One Idea that popped into my head that may-or-may-not work would be to add a constraint trigger that checks if all of the detail records have the same xmin as the order table record. -- Regards, Richard Broersma Jr. Visit the Los

Re: [SQL] Query how-to

2008-10-02 Thread Richard Broersma
) AS closed FROM ( SELECT start_date AS date FROM Yourtable GROUP BY start_date UNION SELECT end_date AS date FROM Yourtable GROUP BY end_date ) AS A ORDER BY A.date; -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users

Re: [SQL] Finding sequential records

2008-09-30 Thread Richard Broersma
duplicates) across multiple relationships, then using natural primary keys becomes very attractive. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make

Re: [SQL] Finding sequential records

2008-09-29 Thread Richard Broersma
that subscribe to www.utteraccess.com get bitten. From what I've seen not one day has gone by without someone posting a question to this site about how to both find and remove all but one of the duplicates. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] Finding sequential records

2008-09-26 Thread Richard Broersma
= D.id OR A.id + 1 = D.id; -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [SQL] Finding sequential records

2008-09-26 Thread Richard Broersma
ON A.id - 1 = D.id OR A.id + 1 = D.id; -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [SQL] surrogate vs natural primary keys

2008-09-17 Thread Richard Broersma
to enforce business rules using ordinary table DDL, I try to use natural keys as often as I can. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes

Re: [SQL] surrogate vs natural primary keys

2008-09-16 Thread Richard Broersma
surrogate keys (for me) are only way to go. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [SQL] a simple transform

2008-09-16 Thread Richard Broersma
On Tue, Sep 16, 2008 at 6:37 AM, Frank Bax [EMAIL PROTECTED] wrote: That pass the SQL into crosstab(). It might be interesting to look at this blog also: http://okbob.blogspot.com/#7449458148004287481 -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG

Re: [SQL] Aggregates in WHERE clause?

2008-09-10 Thread Richard Broersma
. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] order of rows in update

2008-09-03 Thread Richard Broersma
latency. He has configures a revolving Master-Slave replication. Perhaps you guys to share notes? -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes

Re: [SQL] order of rows in update

2008-09-02 Thread Richard Broersma
this is to create a named cursor of the rows that you want to update, and then for each record call UPDATE ... FROM ... WHERE CURRENT OF cursorname; But why are you even having this problem to begin with? What you are describing sounds like a database normalization problem. -- Regards, Richard Broersma

Re: [SQL] LIMIT question

2008-08-19 Thread Richard Broersma
://www.commandprompt.com/blogs/joshua_drake/2007/08/how_many_rows_do_i_have_anyway/ -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription

Re: [SQL] Join question

2008-08-15 Thread Richard Broersma
. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] more than 1000 connections

2008-08-05 Thread Richard Broersma
of the postgresql.conf options are shown as well as the compiler options used to build postgresql. http://www.spec.org/jAppServer2004/results/res2007q3/jAppServer2004-20070703-00073.html I hope this helps. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http

Re: [SQL] How to change a view's owner in postgres(is it possible?)

2008-08-05 Thread Richard Broersma
statement to perform this operation. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] more than 1000 connections

2008-08-05 Thread Richard Broersma
that everyone on the list can participate. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

Re: [SQL] Case Insensitive searches

2008-08-04 Thread Richard Broersma
://www.postgresql.org/docs/8.3/interactive/indexes-expressional.html This way all expression using where lower( column ) = 'a'. will always use an index scan. -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing

Re: [SQL] fast insert-if-key-not-already-there

2008-08-04 Thread Richard Broersma
( v_ip_addr )) AS A( ip_addr ) LEFT JOIN Ip_addresses AS B ON A.ip_addr = B.ip_addr WHERE B.ip_addr IS NULL; -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] Select default values

2008-07-24 Thread Richard Broersma
you could handle the null by passing DEFAULTS to you INSERT or UPDATE statements. I don't know if this would work for you in this case. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list

Re: [SQL] Strange query duration

2008-07-22 Thread Richard Broersma
be encountering a bit of parallax. This shows both 38 and 36 *milliseconds*. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription

Re: [SQL] Rollback in Postgres

2008-07-14 Thread Richard Broersma
on PGfoundry. This project is just getting started and could benefit from a lot of development help. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes

Re: [SQL] Rollback in Postgres

2008-07-14 Thread Richard Broersma
and would work automatically with transaction ids and tuple ids. On the other hand, temporal tables/schemes are implemented by the data modeller. Also the associated temporal operations on the data would be handled by client DML designed to simulate temporal data operations. -- Regards, Richard Broersma

Re: [SQL] column default dependant on another columns value

2008-07-01 Thread Richard Broersma
AS minutes FROM yourtable; -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] ANSI Standard

2008-06-24 Thread Richard Broersma
not commit or at least will be ignored on most databases. We database brand has incorporated a different set of features. How do I identify them? This should get you started : http://www.postgresql.org/docs/8.3/interactive/features.html -- Regards, Richard Broersma Jr. Visit the Los Angles

Re: [SQL] Extremely Low performance with ODBC

2008-05-27 Thread Richard Broersma
and, the log snippet for each query( one from ODBC and one from PGadmin ) (I would attach these as a txt file) the EXPLAIN ANALYZE of your query ( on run from the ODBC client and on from PGadmin) (I would attach these as a txt file) -- Regards, Richard Broersma Jr. Visit the Los Angles

Re: [SQL] Extremely Low performance with ODBC

2008-05-26 Thread Richard Broersma
compare them It should at least tell us what the server is doing differently that is causing the query mis-behavior. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] Extremely Low performance with ODBC

2008-05-23 Thread Richard Broersma
back to the server. If it is trying to perform the join on the client, it could be a big performance killer. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org

Re: [SQL] Extremely Low performance with ODBC

2008-05-23 Thread Richard Broersma
, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Extremely Low performance with ODBC

2008-05-23 Thread Richard Broersma
interface to prefix its select statements with explain analyze. And this, I don't thing can be done. That's why you have to manually view the server logs to see what query are being passed so that identify the problem queries your self. -- Regards, Richard Broersma Jr. Visit the Los Angles

Re: [SQL] Extremely Low performance with ODBC

2008-05-23 Thread Richard Broersma
the query duration when issued by ODBC in the postgresql log to see if it is really taking 2 minutes. It would be nice to see the snippet of the PG log showing this ODBC query with associate duration times. -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http

Re: [SQL] Support for SQL TOP clause?

2008-01-10 Thread Richard Broersma Jr
where criteria you might have GROUP BY I1.name, ... HAVING COUNT(*) 3 ORDER BY I1.name; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Richard Broersma Jr
--- On Mon, 1/7/08, Scott Marlowe [EMAIL PROTECTED] wrote: select max(col1) from table union all select max(col2) from table union all select max(col3) from table Would the following work also? SELECT MAX( GREATEST( col1, col2, col3 ) ) FROM TABLE; Regards, Richard Broersma Jr

Re: [SQL] Limit # of recs on inner join?

2007-12-31 Thread Richard Broersma Jr
SELECT DISTINCT ON ( B.book_id, B.title ) B.book_id, B.title, A.Author FROM Books AS B INNER JOIN Authors AS A ON A.book_id = B.book_id; --- On Mon, 12/31/07, Josh [EMAIL PROTECTED] wrote: From: Josh [EMAIL PROTECTED] Subject: [SQL] Limit # of recs on inner join? To:

Re: [SQL] Advice for generalizing trigger functions

2007-12-27 Thread Richard Broersma Jr
components of the table that will also be needed in the SQL string that will be executed? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Advice for generalizing trigger functions

2007-12-26 Thread Richard Broersma Jr
. If I didn't need to regularly provide this functionality, I would certainly use an EAV history table. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe

Re: [SQL] need help

2007-12-26 Thread Richard Broersma Jr
of PostgreSQL people on IRC: http://www.postgresql.org/community/irc Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] need help

2007-12-26 Thread Richard Broersma Jr
bottom posting when we reply to an email. It is not preferred to put your replies at the top of the email. 3) Try to use descriptive email subjects. For example, your email subject was need help. This subject could be improved to say Need links to online postgresql references. Regards, Richard

Re: [SQL] how to use pgsql like mssql

2007-12-26 Thread Richard Broersma Jr
OS all platforms and is easy to learn and use. http://www.postgresql.org/docs/8.2/interactive/plpgsql.html There are some nice examples in this documentation. Your PGadmin will also have features to help the create these functions also. Regards, Richard Broersma Jr

Re: [SQL] how to use pgsql like mssql

2007-12-26 Thread Richard Broersma Jr
the SQL prompt? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

[SQL] Advice for generalizing trigger functions

2007-12-25 Thread Richard Broersma Jr
of functions into one? Below is a sample of a typical logging trigger function. Regards, Richard Broersma Jr. CREATE OR REPLACE FUNCTION project.log_managers_ops() RETURNS trigger AS $BODY$ BEGIN IF TG_OP IN ( 'UPDATE', 'DELETE' ) THEN UPDATE History.Managers AS M

Re: [SQL] Describe Table

2007-12-17 Thread Richard Broersma Jr
that provide the same useful information as 'psql \d'. So instead, I cheat: start psql with the '-E' option to echo all sql strings psql sends to the back-end server. Simply copy and tailor each statement to suit your needs. Regards, Richard Broersma Jr. ---(end

Re: [SQL] Insert Rule, Multiple Insert, Update Problem

2007-12-10 Thread Richard Broersma Jr
--- On Mon, 12/10/07, Scott [EMAIL PROTECTED] wrote: I am having trouble with an insert rule that also does an update. It works fine for a single insert but multiple inserts in a single statement don't behave as I expected. Yup, that is the limitation of rules. They are only useful if you

Re: [SQL] update on join ?

2007-11-21 Thread Richard Broersma Jr
Inventory SET number = 0 FROM Things WHERE Inventory.thing_fk = Things.thing_id AND Things.color = 'red'; IIRC, Joe Celko referrers to this syntax as T-SQL. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 9: In versions below 8.0

[SQL] Bad Schema Design or Useful Trick?

2007-11-21 Thread Richard Broersma Jr
ON UPDATE CASCADE); Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] postgres bogged down beyond tolerance

2007-11-14 Thread Richard Broersma Jr
] . This mailing list ( pgsql-sql@postgresql.org ) is really intended for discussions of how to construct SQL queries to achieve desired results in a PostgreSQL database. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9

Re: [SQL] Having difficulty writing a best-fit query..

2007-10-16 Thread Richard Broersma Jr
/description#description the only difference was that he was modeling employees and skillsets. IIRC, the terminology for the improved model was the full disjuctive model. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked

Re: [SQL] Need help with CASE statement in Function

2007-10-03 Thread Richard Broersma Jr
? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Many databases

2007-09-21 Thread Richard Broersma Jr
. Not a big deal but it complicates things :-) The veil project already does this. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Simple Query?

2007-09-11 Thread Richard Broersma Jr
with id_search 1 and 2 and 3. Therefore I use the following SQL query. SELECT id_search FROM Search_item GROUP BY id_search HAVING Count( * ) = 3 AND Max( id_item ) = 3 AND Min( id_item ) = 1; Regards, Richard Broersma Jr. ---(end of broadcast

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Richard Broersma Jr
/sql-createview.html I've created large SQL scripts that employ: DROP VIEW IF EXITS viewname; CREATE VIEW ... Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Richard Broersma Jr
schema_name.view_name was does it show as the definition of the column. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
OOPS! --- Richard Broersma Jr [EMAIL PROTECTED] wrote: CREATE UNIQUE INDEX Only_one_row_true ON Your_table ( featured ) WHERE featured = true; Or if you want to only allow 1 featured article per catagory then: CREATE UNIQUE INDEX Only_one_row_true_per_catagory

Re: [SQL] Cast on character columns in views

2007-09-03 Thread Richard Broersma Jr
, table1.col1, CAST( NULL AS CHARACTER( 3 )), table3.type2 FROM table1 JOIN table3 ON table3.fk_table1 = table1.id; Would the above changes work? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support

Re: [SQL] Join question

2007-08-21 Thread Richard Broersma Jr
) a_id, b_id FROM c ) AS c( a_id, b_id ) INNER JOIN a ON c.a_id = a.id INNER JOIN b ON c.b_id = b.id; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Join question

2007-08-21 Thread Richard Broersma Jr
oops... I meant DISTINCT ON ( a_id ) --- Richard Broersma Jr [EMAIL PROTECTED] wrote: SELECT a.x, b.x FROM ( SELECT DISTINCT ON ( a_id ) a_id, b_id ^^ FROM c ) AS c( a_id, b_id ) INNER JOIN a ON c.a_id = a.id INNER JOIN b

[SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Richard Broersma Jr
[, ...] | column_definition [, ...] ) ] Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Richard Broersma Jr
--- Alvaro Herrera [EMAIL PROTECTED] wrote: Any function declared as returning SETOF RECORD needs it, when you don't use OUT params. Before OUT params existed, it was the only way to use those functions. Thanks everyone for the exposition! It makes sense. Regards, Richard Broersma Jr

  1   2   3   >