[SQL] Serialized Transaction Locking Issues

2003-02-04 Thread justin
_test; DROP INDEX [TRANSACTION 2] SELECT * FROM trans_test; ... (Waiting) [TRANSACTION 1] COMMIT; COMMIT (TRANSACTION 2 returns after TRANSACTION 1 COMMIT) val - - 1 2 So is this a glitch or am I missing some nuance of a serializable transaction? In either case I'm eager to f

Re: [SQL] Create custom aggregate function and custom sfunc

2009-07-02 Thread justin
Jasmin Dizdarevic wrote: hi, i have to create a aggregate function which evaluates a maximum text value but with some conditions i have to take care of. is there a way to access a value set of each group? e.g.: customer ; seg 111 ; L1 111 ; L2 111 ; L1 222 ; L3 222 ; L3 222 ; L2 the res

Re: [SQL] simple (?) join

2009-09-24 Thread justin
David W Noon wrote: On Thu, 24 Sep 2009 16:16:36 +0100, Gary Stainburn wrote about [SQL] simple (?) join: create table orders ( o_id serial primary key ... ); create table orders_log ( ol_id serial primary key, o_id int4 not null references orders(o_id), ol_timestamp timestamp,

Re: [SQL] simple (?) join

2009-09-26 Thread justin
Oliveiros C, wrote: Hello, Justin, Gary.   Justin, your (the second one) query is not much different from mine. No its not,   You previewed  the possibility of having orders without any matching entry on orders_log with your left join, something that I haven't.

Re: [SQL] simple (?) join

2009-09-26 Thread justin
David W Noon wrote: A nested query Select orders.*, (SELECT MAX(ol_timestamp) FROM orders_log where orders_log.o_id = orders.oid) >From orders That won't give the desired results. I don't think the SQL parser will even accept it. Yes this is a  valid SQL statemen

Re: [SQL] simple (?) join

2009-09-26 Thread justin
David W Noon wrote: On Sat, 26 Sep 2009 14:54:24 -0400, justin wrote about Re: [SQL] simple (?) join: [snip] Quoting Gary "How can I select all from orders and the last (latest) entry from the orders_log?" In that case, a simple Cartesian product will do:

Re: [SQL] join help

2009-04-08 Thread Justin
Kashmir wrote:only difference is: first table stores data per 'f_rrd_id' evey 5min, and the second table every single minute. I want to run a query that would return for the same 'f_rrd_id' all values from both tables sorted by f_timestamp, of course a set would only have values from the 5m

[SQL] Bad (null) varchar() external representation

2001-01-09 Thread Justin Clift
', '(041) 309 2819', NULL, '1 Blankety-Blank Way\nBazzville', NULL, NULL); ERROR: Bad (null) varchar() external representation etc... I've tried everything I can think of, also exported and reloaded the database, etc. This is a new table with nothing in it. This is driving me nuts. :-( + Justin Clift Database Administrator

[SQL] Possible bug? WAS :Bad (null) varchar() external representation.

2001-01-09 Thread Justin Clift
1', encrypt('foo'), 'Joshua', 1, '1970-07-01', '(03) 9867 5432', '(041) 309 2819', NULL, '1 Blankety-Blank Way\nBazzville', NULL, NULL); INSERT 27605472 1 Removing EITHER of these constraints doesn't work, and n

Re: [SQL] Possible bug? WAS :Bad (null) varchar() external representation.

2001-01-11 Thread Justin Clift
, Justin Clift Database Administrator Tom Lane wrote: > > Justin Clift <[EMAIL PROTECTED]> writes: > > I haven't seen a mention of a maximum number of constraints of similar > > applying to a table. If so, then could someone please point me to it... > > Th

Re: [SQL] Possible bug? WAS :Bad (null) varchar() external representation.

2001-01-11 Thread Justin Clift
om has also suggested using COALESCE instead, so I'll check this out too. Regards and best wishes, Justin Clift Database Administrator Tom Lane wrote: > > > The reason I'm using constraints in the table is to allow the database > > to recognise when oversize data is bei

[SQL] Re: HELP: Scarey pl/pgsql problem

2001-01-31 Thread Justin Clift
est box. After installing the Postgres 7.0.3 rpms from the PostgreSQL site, pl/pgsql is working consistently again. It looks like the rpms for PostgreSQL supplied with Mandrake Linux 7.2 are broken, I guess they didn't run the supplied tests before packaging. :-( Regards and best wishes, J

[SQL] HELP: Scarey pl/pgsql problem

2001-02-05 Thread Justin Clift
below : CREATE FUNCTION which_block(time) RETURNS time AS 'DECLARE /* Given a time, this function works out the name of the correct field in the reservations table for it * Written by : Justin Clift * Date : 1st February 2001 * Version: 1.00 */ hours char(3);

[SQL] Suggestions on finetuning this search?

2001-02-16 Thread Justin Long
I would welcome any suggestions for fine-tuning this search to run faster. Here is the SQL. Basically what we're allowing people to do is to specify words to search our article index. THE TABLES: knowledge = the knowledge base of articles kb_categories = the category that each article is assign

[SQL] Re: Help needed -> ERROR: record arow has no field description

2001-02-28 Thread Justin Clift
me to add a section on error messages into techdocs.postgresql.org (very messy at the moment, I'll fix it tonight). Regards and best wishes, + Justin Clift Database Administrator Justin Clift wrote: > > Hi all, > > I'm getting this error, which to me makes no sense

[SQL] Help needed -> ERROR: record arow has no field description

2001-03-02 Thread Justin Clift
tried several variations, and the mailing lists don't even have a reference for this error message. Regards and best wishes, Justin Clift Database Administrator ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister c

[SQL] Optimizing Query

2001-03-05 Thread Justin Long
0.kbid, w0.wordid. Any suggestions for further optimization would be very welcome. We get about 3,000 searches on our database daily... Blessings, Justin Long ________ Justin Long Network for Strategic

Re: [SQL] Optimizing Query

2001-03-05 Thread Justin Long
be your backup.    |  Drexel Hill, Pennsylvania 19026 ____ Justin Long Network for Strategic Missions [EMAIL PROTECTED] 1732 South Park Court http://www.strategicnetwork.org Chesape

Re: [SQL] Optimizing Query

2001-03-05 Thread Justin Long
Yes, it drops indexes, much to my chagrin, as I just realized ... including SERIALs... Justin At 04:45 PM 3/5/2001 -0500, you wrote: Yes. > On Mon, Mar 05, 2001 at 04:07:57PM -0500, Bruce Momjian allegedly wrote: > > Have you tried VACUUM ANALYZE and CLUSTER? > > I assume CLUS

Re: [SQL] Optimizing Query

2001-03-05 Thread Justin Long
rdid=42743... why isn't it doing an indexscan? wouldn't that be more efficient? Justin At 04:45 PM 3/5/2001 -0500, you wrote: Yes. > On Mon, Mar 05, 2001 at 04:07:57PM -0500, Bruce Momjian allegedly wrote: > > Have you tried VACUUM ANALYZE and CLUSTER? > > I assume CL

Re: [SQL] Optimizing Query

2001-03-06 Thread Justin Long
Wow. I can't believe the difference. It didn't take too long. I'll set up a script in my etc/cron.weekly to run it... would there be any benefit to doing a vacuum analyze nightly? Justin Long At 11:10 PM 3/5/2001 -0500, you wrote: Justin Long <[EMAIL PROTECTED]> writes: >

Re: [SQL] quotes in pl/pgsql

2001-03-07 Thread Justin Clift
Hi Najm, Is this what you mean? CREATE FUNCTION foobar(int4) returns int4 as 'DECLARE textbuf varchar(120); BEGIN  textbuf := ''Example Text ''; insert into sometable (something) values (textbuf); RETURN 0; END;' LANGUAGE 'plpgsql'; Najm Hashmi wrote: > > Hi all, I

Re: [SQL] Function Vanished

2001-03-26 Thread Justin Clift
Hi would it work to do a pg_dump -d or a pgdumpall, then look through the dumped sql file? I do that to retrieve PL/pgSQL functions from the database when I've accidentally wiped or modified the source (not often, but it happens). Regards and best wishes, Justin Clift Tom Lane

Re: [SQL] Range of Serial values

2001-04-16 Thread Justin Clift
Hi, I believe you could also create the sequence, then update it with setval('', ); Regards and best wishes, Justin Clift "Poul L. Christiansen" wrote: > > Yes, there is. > > When you create a serial column a sequence is created, which does the > cou

Re: [SQL] any proper benchmark scripts?

2001-04-19 Thread Justin Clift
. Out of curiosity do you have access to other databases such as Interbase, Oracle, DB2, Informix, and so forth? The more it can connect to, the better people will be able to understand each one's strengths and weaknesses, in terms of Perl's DB access. Regards and best wishes, Justin Clif

Re: [SQL] error message...

2001-05-15 Thread Justin Clift
;. If it starts it with "postmaster", then use -N directly, without the -o. The man pages for pg_ctl and postmaster should be of some benefit also. Regards and best wishes, Justin Clift "S.E.Franke" wrote: > > Hi I have Postgres 7.0.3/6 on a Suse Professional 7.1 (ke

Re: [SQL] execute client application from PL/pgSql

2001-05-15 Thread Justin Clift
ding quite nicely. :-) Regards and best wishes, Justin Clift Jeff MacDonald wrote: > > hi, > > phpPGAdmin is a web based php driven postgresql > admin tool. not sure of the exact url, try > google :) > > it has a pg_dump option in it. > > jeff > > On Sat,

Re: [SQL] system time

2001-05-15 Thread Justin Clift
select now(); ??? + Justin Seema Noor wrote: > > is there any function from which i can get system time? > > > Do You Yahoo!? > Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk > or your free @yah

Re: [SQL] has anyone tried running in MAC OS X

2001-05-18 Thread Justin Clift
t. If you need further assistance, feel free to ask. :-) Regards and best wishes, Justin Clift Tom Lane wrote: > > "postgresql" <[EMAIL PROTECTED]> writes: > > I guess the subject line says ithas anyone tried running > > PostgreSQL in MAC OS X. > > S

[SQL] Re: [GENERAL] Re: Mirroring the database?

2001-08-14 Thread Justin Clift
There's also PostgreSQL Replicator (which I haven't gotten around to trying) : http://pgreplicator.sourceforge.net :-) Regards and best wishes, Justin Clift Allan Engelhardt wrote: > > Ehhh, use dual-ported RAID disks? (Well, tri-port in your case, but maybe A and B >

[SQL] select for update

2002-11-26 Thread Justin Georgeson
to t2 and t3. t2.id = t1.id t2.groupname = t1.username t2.owner = t1.username t3.id = t3.groupid = t1.id t3.username = t1.username t3.writeperms = 31 PS - I'm not subscribed to the list, so please CC my email with responses. -- ; Justin Georgeson ; http://www.lopht.net ; mailto:[EMAIL

Re: [SQL] join on next row

2006-06-21 Thread Justin Lintz
ql.org/docs/faq-- - Justin

Re: [SQL] plpgsql loop question

2010-02-10 Thread Justin Graf
On 2/10/2010 11:29 AM, Andrea Visinoni wrote: > hi, > i have a table called "zones": idzone, zone_name > and several tables called zonename_records (same structure), where > zonename is one of the zone_name in the "zones" table. > What i want to do is a function that union all of this tables > di

Re: [SQL] 'image' table with relationships to different objects

2010-02-10 Thread Justin Graf
On 2/9/2010 6:59 AM, Richard Huxton wrote: > On 09/02/10 07:49, Louis-David Mitterrand wrote: >> Hello, >> >> In my database I have different object types (person, location, event, >> etc.) all of which can have several images attached. >> >> What is the best way to manage a single 'image' table wi

Re: [SQL] MSSQL to PostgreSQL - Issue trying to generate unique ID using actual date

2010-03-18 Thread Justin Graf
On 3/17/2010 9:52 AM, Ignacio Balcarce wrote: > > Hi all, > > I am facing a problem trying to convert from MSSQL procedure to > PostgreSQL function. > > CREATE PROCEDURE dbo.THUBAN_SP_GENERATEID > > @NEWID VARCHAR(20) OUTPUT > > AS > > SET @NEWID = ( > > SELECT REPLACE(SUBSTRING(CONVERT(C

Re: [SQL] MSSQL to PostgreSQL - Issue trying to generate unique ID using actual date

2010-03-18 Thread Justin Graf
On 3/18/2010 12:53 PM, Ignacio Balcarce wrote: > > Justin, > > Thanks in advance for your email. I forgot to tell than everyday IDs > must start from 0. So… sequence id would look like: MMDD 0001, > MMDD 0002, etc. > > Is there any way to make this sequenc

Re: [SQL] MSSQL to PostgreSQL - Issue trying to generate unique ID using actual date

2010-03-18 Thread Justin Graf
OOPS did not mean to click send On 3/18/2010 12:53 PM, Ignacio Balcarce wrote: > > Justin, > > Thanks in advance for your email. I forgot to tell than everyday IDs > must start from 0. So… sequence id would look like: MMDD 0001, > MMDD 0002, etc. > >

Re: [SQL] Inserting Multiple Random Rows

2010-04-28 Thread Justin Graf
That won't work because Order by does not recompute Random() once gets a number it stops you need to generate a series of random numbers then select each record one at a time out of cities table . You will have to write a plsql function to do this As any join will cause the result to be order

Re: [SQL] Inserting Multiple Random Rows

2010-04-28 Thread Justin Graf
On 4/28/2010 1:48 PM, Gary Chambers wrote: > pen? > > The clouds parting, choirs of angels singing, and fireworks > celebrating the veil of my obtuseness being lifted, and my grasp and > command of SQL to be complete and infinite. None of which appears > will ever happen... > > -- Gary Chamber

Re: [SPAM]-D] [SQL] How to find broken UTF-8 characters ?

2010-04-29 Thread Justin Graf
On 4/28/2010 10:34 PM, Andreas wrote: > Hi, > > while writing the reply below I found it sounds like beeing OT but > it's actually not. > I just need a way to check if a collumn contains values that CAN NOT > be converted from Utf8 to Latin1. > I tried: > Select convert_to (my_column::text, 'LATI

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Justin Graf
On 5/6/2010 4:12 PM, Plugge, Joe R. wrote: > > I am trying to create a update trigger on a table that basically will > only fire when a specific column is updated. I am using version 8.4.3. > > My plan of attack was to always fire on any row update, and pass in > the OLD and NEW column that I wa

Re: [SQL] Celko take on EAV

2010-05-07 Thread Justin Graf
On 5/7/2010 12:33 PM, Richard Broersma wrote: > > > I'm rereading my Joe Celko's SQL Programming Style and I noticed an > interesting comment regarding the EAV model (of course he discourages > its use): > > "There are better tools for collecting free-from data." > > What tools was he referring to

Re: [SQL] best paging strategies for large datasets?

2010-05-12 Thread Justin Graf
On 5/12/2010 1:41 AM, Louis-David Mitterrand wrote: > Hi, > > I have a large dataset (page 1 at http://www.cruisefish.net/stat.md) and > am in the process of developping a pager to let users leaf through it > (30K rows). > That's not that big of a record set. > Ideally I'd like to know when r

Re: [SQL] best paging strategies for large datasets?

2010-05-12 Thread Justin Graf
oops typos On 5/12/2010 1:41 AM, Louis-David Mitterrand wrote: > Hi, > > I have a large dataset (page 1 at http://www.cruisefish.net/stat.md) and > am in the process of developping a pager to let users leaf through it > (30K rows). > That's not that big of a record set. > Ideally I'd like to know

Re: [SQL] best paging strategies for large datasets?

2010-05-13 Thread Justin Graf
On 5/13/2010 4:41 AM, silly sad wrote: > >>> First u count(*) the rows and select a requested page >>> returning to a client the count result bundled "with a page of rows" >>> >>> (1) client renders the acquired rows >>> (2)__memorize__ what part of the data he just got >>> (3) and stores the count

Re: [SQL] best paging strategies for large datasets?

2010-05-13 Thread Justin Graf
On 5/13/2010 3:43 AM, Louis-David Mitterrand wrote: **snip*** > >> What do you mean by quite slow?? >> > Like several seconds. I have to cache the results. > Well then i suggest posting the queries to Performance or here and let us take a look them don't forget to include the explain/an

Re: [SQL] user function and bind

2010-05-19 Thread Justin Graf
On 5/19/2010 9:56 AM, David Harel wrote: > Hi, > I need an example how to write user function with columns binding and > how to use it on PHP > -- > Thanks. > I'm not sure i understand your question. You want a function to return record type correct?? All legitimate Magwerks Cor

Re: [SQL] how to construct sql

2010-06-02 Thread Justin Graf
On 6/2/2010 12:31 PM, Wes James wrote: > On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros > wrote: > >> Hi, >> Have you already tried this out? >> >> select MAX(page_count_count) - MIN(page_count_count) from page_count group >> by page_count_pdate. >> >> >> Best, >> Oliveiros >> > Oliveiros,

Re: [SQL] how to construct sql

2010-06-02 Thread Justin Graf
On 6/2/2010 2:52 PM, Wes James wrote: > > **snip*** > Thx it is closer (with an end in the case): > > select > case when MAX(page_count_count) - MIN(page_count_count)> 0 then > MAX(page_count_count) - MIN(page_count_count) > else > MAX(page_count_count) > end as day_max > from pa

Re: [SQL]

2010-07-06 Thread Justin Graf
I wrote an article covering this on the wiki http://wiki.postgresql.org/wiki/BinaryFilesInDB I need to update to for 9.0 as bytea now allows HEX format strings http://developer.postgresql.org/pgdocs/postgres/datatype-binary.html All legitimate Magwerks Corporation quotations are sent in

Re: [SQL]

2010-07-07 Thread Justin Graf
On 7/7/2010 12:00 AM, silly sad wrote: > On 07/06/10 21:52, Justin Graf wrote: > >> I wrote an article covering this on the wiki >> >> http://wiki.postgresql.org/wiki/BinaryFilesInDB >> > there are some "red flags" in communication > (particu

Re: [SQL] strangest thing happened

2010-07-07 Thread Justin Graf
Are you using PG's sequence/auto increment??? If so. Once PG fires off the nextval() for the sequence that number is considered used and gone even if the transaction that called nextval() is rolled back Depending on how the app is written nextval() might be called, but allow the User to cance

Re: [SQL] strangest thing happened

2010-07-07 Thread Justin Graf
On 7/7/2010 3:42 PM, Ross J. Reedstrom wrote: > > Justin, you're missing that John reported that the sequences are > _behind_ the table. This only happens for me if I've been doing > bulk data loads. Then I use: > > select setval(sequence_name,max(serial_id_column

Re: [SQL] strangest thing happened

2010-07-08 Thread Justin Graf
On 7/7/2010 5:41 PM, John wrote: > On Wednesday 07 July 2010 03:14:40 pm Justin Graf wrote: > >> I would be looking at the log files for the Inserts into that table as a >> means to track down what is the cause. If there are no log files or >> don't have enough

Re: [SQL] how to escape _ in select

2010-07-28 Thread Justin Graf
On 7/28/2010 12:35 PM, Wes James wrote: > I'm trying to do this: > > select * from table where field::text ilike '%\_%'; > > but it doesn't work. > > How do you escape the _ and $ chars? > > The docs say to use \, but that isn't working. > > ( http://www.postgresql.org/docs/8.3/static/functions-mat

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

2010-08-04 Thread Justin Graf
On 8/4/2010 1:56 PM, Richard Broersma wrote: > On Wed, Aug 4, 2010 at 11:51 AM, Peter Koczan wrote: > > >> This is one of my first forays into ODBC, so I didn't know that was a >> possibility. Is there any place where these are documented? Searching >> for ODBC options yields info on connectio