Re: [SQL] Querying a list field against another list

2004-11-27 Thread m
Try this: CREATE OR REPLACE FUNCTION csv_matches(TEXT, TEXT) RETURNS BOOLEAN AS $$ DECLARE -- $1 is the field text, $2 is the list of ints to try and match. m TEXT; f TEXT; i INTEGER := 1; j INTEGER; BEGIN IF $1 IS NULL THEN RETURN &#

Re: [SQL] Deleting obsolete values

2001-10-23 Thread Pat M
Delete from partitur where userid NOT IN (SELECT DISTINCT ON (userid) userid, val, ts FROM partitur) "Haller Christoph" <[EMAIL PROTECTED]> wrote in message 200110161445.QAA11833@rodos">news:200110161445.QAA11833@rodos... > This may look familiar to you - it was on the list last month. > Consider

[SQL] Function return rows?

2001-10-02 Thread Pat M
Can I use a function to execute a query and return a row or set of rows? If so, can you point me to some examples or perhaps give me an example of a function that would do roughly the same thing as: select * from mytable where mytable.name ~* 'aname'; I can't seem to find any examples that retur

[SQL] Cenceptual help needed - periodic events

2001-10-15 Thread Pat M
I'm goofing around, designing a planned maintenance system. In a couple of weeks I'll be taking on the actual scheduling of tasks. How would you experts out there approach this? I've beeen thinking I can approach this two ways. 1) When a list of tasks is requested, generate new rows and store the

[SQL] trigger to maintain relationships

2002-12-11 Thread David M
I am maintaining a set of hierarchical data that looks a lot like a tree. (And my SQL is very rusty. And I'm new to postgres.) Questions: - 1.) Is the following a reasonable solution? Is there a postgres-specific way to handle this better? Is there a good generic SQL way to handle

Re: [SQL] trigger to maintain relationships

2002-12-11 Thread David M
ect NEW.node_id, ancestor_id from NEW left outer join ancestors on (NEW.parent_id = ancestors.node_id); return NEW;' language 'plpgsql'; create trigger tr_i_nodes after insert on nodes for each row execute procedure pr_tr_i_nodes(); David M wrote: > I am maintainin

[SQL] Why their is a limit in Postgresql (psql) Parameters..?

2003-07-21 Thread vijaykumar M
Hi All, I'm using Postgresql v7.3.3. I have a small question ... Why is that there is a maximum limit of 32 input parameters to thePostgresql function?  Whereas stored procedures in Oracle and SQL Servertake more than 32 input arguments. So this puts extra burden on themiddleware dev

[SQL] Postgresql Temporary table scripts..

2003-07-21 Thread vijaykumar M
Hi, I'm using Postgresqlv7.3.3. Actually my requirement was to create one temporary table and insert some values on it and finally return the inserted values. For this simple thing i'm struggling a lot with two errors. one is 'RELATION '' ALREADY EXISTS' -- This is happening when ever i ca

[SQL] Equivalent to sql%rowcount or @@rowcount

2003-07-24 Thread vijaykumar M
Hi All! is it possible to get in sql number of rows affected by the sql last insert, update or delete statement?? for eg, oracle - sql%rowcount. sqlserver select @@rowcount. Any help will be highly appreciated.. Thanks Regards, VijayCool new emoticons. Lots of colo

[SQL] problem in database backup

2003-07-31 Thread vijaykumar M
Hi All, I'm using Postgresql V7.3.3, on that i created one database with name "mydb".  PostgreSQL 7.3.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7) While taking a backup of my postgresql database, i'm getting the below error. bash-2.05b$ pg_dump mydb >myd

Re: [SQL] problem in database backup

2003-07-31 Thread vijaykumar M
Hi Tomasz Myrta, Thanks for ur info, u r correct .. after pointing to /usr/bin/pgsql/bin/pg_dump, i'm able to take backup.. Thank u very much.. With Regards Vijay   >From: Tomasz Myrta <[EMAIL PROTECTED]> >To: vijaykumar M <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] &

[SQL] createlang plpgsql failing on redhatlinux7.2

2003-09-12 Thread vijaykumar M
Hi All, I'm getting some problem on "createlang plpgsql". with REDHATLINUX7.2 These are all my system configurations.. We have a machine with  RedhatLinix 7.2, on top of this i upgraded the postgresql7.3.3 version. After creating a database, i'm trying to create a language for that database by us

[SQL] createlang problme

2003-09-12 Thread vijaykumar M
Hi All, i'm using RedhatLinux7.2, on top of this i upgrade the Postgres with V7.3.3. After that, i tried to create a language with a createlang command. ERROR: Load of file /usr/local/pgsql/lib/plpgsql.so failed: /usr/local/pgsql/lib/plpgsql.so: un defined symbol: xlateSqlType createlang: language

[SQL]

2003-09-25 Thread vijaykumar M
Hi all, I have few questions to clear my self.. 1. Is that postgres supports distributed database ? _ Talk to Karthikeyan. Watch his stunning feats. http://server1.msn.co.in/sp03/tataracing/index.asp Download images. ---

[SQL] few questions ..?

2003-09-25 Thread vijaykumar M
Hi All, I have few questions, kindly suggest your comments on this.. 1. Is that postgres supports distributed database ? In oracle, by creating Dblink we can communicate the remorte database from the local one. How you could implement this in postgres database. 2. Is the

Re: [SQL] few questions ..?

2003-09-25 Thread vijaykumar M
Thanks richards ..i will go through that doc.. With Regards Vijay From: Richard Huxton <[EMAIL PROTECTED]> To: "vijaykumar M" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: Re: [SQL] few questions ..? Date: Thu, 25 Sep 2003 11:07:00 +0100 On Thursday 25 September 2003 09:

Re: [SQL] Temporary tables

2003-09-28 Thread vijaykumar M
Hi, Try the below steps .. 1. Write one procedure to create tempory table (generic purpose) ** CREATE OR REPLACE FUNCTION SP_CREATE_TEMP_TABLE () RETURNS VARCHAR AS ' DECLARE L_SchemaName name; BEGIN EXECUTE ''CREATE TEMPORARY T

[SQL] how to read bytea contents by using pgsql scripts

2003-11-24 Thread vijaykumar M
Hi All, Is their any way to read the bytea contents by using pgsql script. Thanks & regards Vijay _ BharatMatrimony.com. http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 India's premium matrimonial website. --

Re: [SQL] how to read bytea contents by using pgsql scripts

2003-11-24 Thread vijaykumar M
From: Christoph Haller <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] (vijaykumar M) CC: [EMAIL PROTECTED] Subject: Re: [SQL] how to read bytea contents by using pgsql scripts Date: Mon, 24 Nov 2003 11:26:02 MET > > Hi All, > Is their any way to read the bytea contents by using pgsq

Re: [SQL] how to read bytea contents by using pgsql scripts

2003-11-24 Thread vijaykumar M
Hi Christoph, Yes, U catched my problem, i want to know the original stored contents (not in byte form). With thanks and regards Vijay From: Christoph Haller <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] (vijaykumar M) CC: [EMAIL PROTECTED] Subject: Re: [SQL] how to read bytea conte

[SQL] Pgaccess problem

2003-12-16 Thread vijaykumar M
Hi All, I am trying to install pgaccess on a redhat 7.2 linux server with postgres7.4. Everything seems to be alright but when I go to run pgaccess I get an error message saying Application initialization failed: no display name and no $DISPLAY environment v ariable Error in startup script: in

[SQL] Pgaccess problem on RedhatLinux9

2003-12-22 Thread vijaykumar M
Hi All, Previously i was used RedhatLinux7.2 & Postgres7.4, that time i'm able to use the pgaccess command to view the tables. Presently, i'm using RedhatLinux9 & Postgres7.4, here i'm not able to use the pgaccess command. It is saying "command not found." One thing, i observed was on R

[SQL] Entered data appears TWICE in table!!?

2004-04-05 Thread Ron M.
first, last) values ('Bill' , 'Smith'); ***Then look at the table: select * from rnmrgntable; And I get: firstlast BillSmith BillSmith EVERYTHING I enter appears twice, duplicated on two rows as in this example. What the heck's going on? Ron M.

[SQL] Database triggers

2004-04-19 Thread Charity M
I have a lab assignment that I have been struggling with. We are using oracle sql. Can someone please help me. See the lab below. I have done ques 1 - 3 thus far and am now stuck on triggers ques 4 - 6. THIS IS THE LAB: 1. Create a table called QUOTE. · Give the table an initial and n

Re: [SQL] Database triggers

2004-04-19 Thread Charity M
Thank you, will look at the reference manual. This is how I've done it to this point. It runs and the trigger is created but am not quite sure if its the right thing. CREATE OR REPLACE TRIGGER QUOTE_TRG BEFORE INSERT or DELETE OR UPDATE ON QUOTE FOR EACH ROW DECLARE today_date date;

[SQL] Storing properties in a logical way.

2004-09-05 Thread Daniel M.
Hello everybody, In a database there is a table with items, and each item can have 0 to n properties. The objective is to store information about items' properties in a mentioned database in a logical and an efficient way. Usually it is easily done by creating a validation table with a list of poss

Re: [SQL] Storing properties in a logical way.

2004-09-06 Thread Daniel M.
On Sun, 05 Sep 2004 19:51:44 +0200, Pierre-Frédéric Caillaud <[EMAIL PROTECTED]> wrote: >> But after looking closely at the list of a possible properties, i found >> out that some of them depend on others. For example, if item is a >> PDF document, it can have an index. But a document can also ha

[SQL] HowTo change encoding type....

2004-11-25 Thread Andrew M
Hi, how do I change the encoding type in postgreSQL (8) from UTF-8 to ISO-8859-1? many thanks Andrew <>  +The home of urban music + http://www.beyarecords.com ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Failed system call was shmget(key=1, size=1155072, 03600).

2004-12-03 Thread Andrew M
Hi, when building postgreSQL 8 I get the following error message: DETAIL: Failed system call was shmget(key=1, size=1155072, 03600). HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currentl

[SQL] unsubscribe pgsql-sql

2005-03-31 Thread Robin M.
unsubscribe pgsql-sql ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-25 Thread Jayadevan M
Hi, Is this what you are trying to do? postgres=# select * from (select count(*) from people ) p, (select firstname from people)p2; count | firstname ---+--- 5 | Mary 5 | Mary 5 | John 5 | John 5 | Jacob (5 rows) I do not know about the performance impact of s

Re: [SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-25 Thread Jayadevan M
Hi, I don't think so. Oracle - SQL> select count(*) over () as ROWCOUNT , first_name from people; ROWCOUNT FIRST_NAME -- - --- 6 Mary 6 Mary 6 John 6 John

Re: [SQL] SQL syntax rowcount value as an extra column in the result set

2010-03-25 Thread Jayadevan M
Hi, >It works, but you should use a recent version: >test=*# select count(1) over (), i from foo; > count | i >---+ > 8 | 1 > 8 | 2 > 8 | 3 > 8 | 6 > 8 | 7 > 8 | 9 > 8 | 13 > 8 | 14 >(8 rows) > test=*# select version(); >

Re: [SQL] LEFT OUTER JOIN issue

2010-04-21 Thread Jayadevan M
Hi, > SELECT ct.dat,ct.heur,hp.datmesure,hp.heuremesure,hp.t FROM calendar_temp as ct > LEFT OUTER JOIN h_part as hp > ON ct.dat = hp.datmesure > AND ct.heur = hp.heuremesure > WHERE > hp.poste_idposte = 275 > ORDER BY ct.dat, ct.heur > dat heur datmesure heu

Re: [SQL] [GENERAL] How to Get Column Names from the Table

2010-07-07 Thread Jayadevan M
> Use: > \d tablename And what I really like about it is the way you can make a guess about the table name and use * . postgres-# \d mt* Table "public.mt1" Column | Type | Modifiers +-+--- id | integer | Table "public.mt2" Column | Type | Modi

Re: [SQL] SUM the result of a subquery.

2010-09-02 Thread Jayadevan M
> SELECT SUM ( > (SELECT i.id_item, i.price, SUM (o.quantity), ROUND (SUM > (o.quantity) * i.price, 2) AS cost > FROM orders o > JOIN items i ON i.id_item = o.id_item > WHERE o.date_order BETWEEN '2010-01-01' AND '2010-01-31' > GROUP BY i.id_item, i.price) > ); > > No luck. Obviously SUM expects

Re: [SQL] find and replace the string within a column

2010-09-24 Thread Jayadevan M
Hello, > the below one help's me to find the data within the two brackets. > > SELECT name,(REGEXP_MATCHES(name, E'\\(.+?\\)'))[1] from person; > regexp_matches > > (S/o Sebastin ) > - > Trying to work with your code - upda

Re: [SQL] Calculate next event date based on instance of the day of week

2010-12-02 Thread Jayadevan M
Hello, > I have a table which stores an event date. The event is stored as a > standard mm/dd/yy entry. > > I then need to calculate based on the dd value, WHICH day of the > week that is (e.g. Wednesday) and which occurrence of that day of > the week, within the month, it is (e.g. the THIRD We

Re: [SQL] Get the max viewd product_id for user_id

2010-12-03 Thread Jayadevan M
Hello, > I went this way, but for a large number of user_id's, it's quite slow: > > CREATE VIEW v_views AS >SELECT user_id, product_id, count(*) as views >FROM viewlog >GROUP BY user_id, product_id > > SELECT >DISTINCT user_id, >(SELECT product_id FROM v_views inn WHERE inn.u

Re: [SQL] Get the max viewd product_id for user_id

2010-12-05 Thread Jayadevan M
> > The issue in both approaches is that if I have two product_ids that are > > viewed same number of times and share the first place as most viewed > > products by that user, I'll get only one of them (LIMIT 1 OR MAX() can > > only return one row :). > > > > And then, to jump again into my own m

[SQL] group by with sum and sum till max date

2011-07-05 Thread M. D.
This is a little hard to explain, and I'm not sure if it's possible, but here goes. This is my query: select year, month, (select number from account where account.account_id = view_account_change.account_id) as number, (select name from account where account.account_id = view_account_change.a

[SQL] parsing audit table

2011-08-16 Thread M. D.
Hi everyone, I'm a bit lazy, or actually in a bit of a crunch. I added an audit recording a few months ago, but never really used it much, but today I'm seeing a bunch of suspicious activity by one user. Does someone have any function to quickly parse this data? I followed this: http://wik

[SQL] running totals with end of month line

2011-11-30 Thread M. D.
Hi everyone, I would like to create a query that does a running total for each account, but I also want to show a 'phantom' row that gives the end of month with the last day of the month as the transaction date. Here's a sample query: SELECT n.customer_id, n

[SQL] help on a function with exception

2012-03-14 Thread M. D.
Hi, I want to do a check on a column if other columns meet certain conditions. The program I'm working with allows to create additional columns on every 'object' - called extra data, but I have no control over the program. I want to enforce the values on this one extra data to be of type dat

Re: [SQL] Postgresql function which compares values from both tables

2012-03-19 Thread Jayadevan M
Hi, > To: pgsql-sql@postgresql.org > Subject: [SQL] Postgresql function which compares values from both tables > > hi , > how to write a function which should read data from 2 tables having > same number of columns and should show the common values from those tables. If you want to compare and

Re: [SQL] How to limit access only to certain records?

2012-06-22 Thread Jayadevan M
HI, > > is there a way to limit access for some users only to certain records? > > e.g. there is a customer table and there are account-managers. > Could I limit account-manager #1 so that he only can access customers > only acording to a flag? > > Say I create a relation cu_am ( customer_id,

[SQL] Aggregate over a linked list

2013-01-17 Thread M Lubratt
Hello! I trade futures contracts and I have a PostgreSQL 9.2 database that keeps track of all of my trading activity. The table includes columns for the futures contract, the entry and exit dates and the profit for that particular trade. Now, futures contracts expire, so within a trade being ind

Re: [SQL] DB link from postgres to Oracle; how to query Dbname.tablename?

2013-10-02 Thread Jayadevan M
preceding 3 lines from PG_LINK;* > > I tried dbname.tablename syntax, but it didn't work! BTW, all my tables > belong to public schema. > > Does anyone with DB link expertise try to answer my question? > > Thanks, > Bhanu M. Gandikota > Mobile: (415) 420-7740 &g

[SQL] pg_dump

2006-09-05 Thread M. Santosa
I've install postgres in linux. but pg_dump its not working at all. if i execute the pg_dump to the file like this pg_dump -Upostgres -dpostgres > file.dmp the file file.dmp is empty and if i execute the psql with list database option, the result is error -bash-3.00$ psql -l ERROR: relation

Re: [SQL] AUTO INCREMENT

2000-06-10 Thread M . Mazurek
On Sat, 10 Jun 2000, GANESH KUMAR wrote: > i am searching for > autoincrement in table > > in table employee > i want give empno as autoincrement create table xyz (id serial primary key); check documentation what it really is:). Marcin Mazurek -- administrator MULTINET SA o/Poznan http://ww

[SQL] ltsWriteBlock: failed to write block XX of temporary file. Perharps out of disk space...

2001-01-18 Thread Ligia M. Pimentel
I have a database and a table with 7 records (which i dont think it's too much) I join this table with another of about the same size and put a record restriction (WHERE) and everything works out fine, but when I put two SUMs over a couple of fields and add a GROUP BY I keep getting this erro

[SQL] Re: ltsWriteBlock: failed to write block XX of temporary file. Perharps out of disk space...

2001-01-18 Thread Ligia M. Pimentel
I fixed it!, it just added an index! Thanks anyway... "Ligia M. Pimentel" <[EMAIL PROTECTED]> wrote in message 944kbb$114p$[EMAIL PROTECTED]">news:944kbb$114p$[EMAIL PROTECTED]... > I have a database and a table with 7 records (which i dont think it's >

[SQL] Query optimizing - paradox behave

2001-07-19 Thread David M. Richter
haracter varying(80) | The times of the processes are escape-eliminated by statistical methods. I determined that the "compare" database is 8% times faster than the new restructured "pacs" database. How can I understand this? Whats my mistake? Anybody who can make some

[SQL] Query optimizing - paradox behave

2001-07-20 Thread David M. Richter
ying(128) | patientoid | character varying(80) | The times of the processes are escape-eliminated by statistical methods. I determined that the "compare" database is 8% times faster than the new restructured "pacs" database. How can I understand this? Whats

[SQL] Re: Query optimizing - paradox behave

2001-07-24 Thread David M. Richter
to me? Why is the usertime increased and the whole time is decreased? # Anyway .. Thanks all a lot for Your effort. I will now tune my radiology-database further... Thankful Greetings David "David M. Richter" <[EMAIL PROTECTED]> writes: > The query with the 3 tables is fast

[SQL] Re: Query optimizing - paradox behave

2001-07-24 Thread David M. Richter
any ;Heidelberg;Germany;; x-mozilla-cpt:;-15296 fn:David M. Richter end:vcard ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

[SQL] View consistency

2001-11-01 Thread David M. Richter
email;internet:[EMAIL PROTECTED] adr;quoted-printable:;;Im Neuenheimer Feld 280 url: http://mbi.DKFZ-Heidelberg.de/=0D=0AD-69120 Heidelberg, Germany ;Heidelberg;Germany;; x-mozilla-cpt:;-17024 fn:David M. Richter end:vcard ---(end of broadcast

[SQL] table restruction

2001-09-20 Thread David M. Richter
de/=0D=0AD-69120 Heidelberg, Germany ;Heidelberg;Germany;; x-mozilla-cpt:;-17024 fn:David M. Richter end:vcard ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] table restruct...

2001-09-20 Thread David M. Richter
;Heidelberg;Germany;; x-mozilla-cpt:;-17024 fn:David M. Richter end:vcard ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Conversion

2002-08-12 Thread Alexander M. Pravking
types might disappear in a future release. Don't they? -- Fduch M. Pravking ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Conversion

2002-08-13 Thread Alexander M. Pravking
epoch'::timestamp + (int4field::text || 's')::interval, but it's much much slower... And it seems not to handle timestamps after 2038-01-19. -- Fduch M. Pravking ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] Results from EXECUTE

2002-08-16 Thread Alexander M. Pravking
How can I obtain results from an EXECUTE statement within a pl/PgSQL function? E.g., something like value := EXECUTE ''SELECT '' || quote_ident(field_name) || '' FROM ...''; Thanks in advice. -- Fduch M. Pravking ---(end of bro

Re: [SQL] Different size in the DATA directory

2002-11-02 Thread Alexander M. Pravking
erl for commandline procesing. I don't think it's a good idea, since e.g. FreeBSD 5.0-CURRENT have no perl in standard distribution. Thomas, why not to use sed? -- Fduch M. Pravking ---(end of broadcast)--- TIP 5: Have you che

Re: [SQL] Different size in the DATA directory

2002-11-03 Thread Alexander M. Pravking
On Sat, Nov 02, 2002 at 08:20:04PM -0500, Bruce Momjian wrote: > Alexander M. Pravking wrote: > > As I see, contrib/reindexdb requires perl for commandline > > procesing. I don't think it's a good idea, since > > e.g. FreeBSD 5.0-CURRENT have no perl in standard dis

[SQL] Problem with looping on a table function result

2003-07-31 Thread Alexander M. Pravking
o the trick without writing one more PL/PgSQL table function doing FOR row IN SELECT ... LOOP or using client-side loop? Thanks for your help. -- Fduch M. Pravking ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Expression transformation curiosity

2003-08-17 Thread Alexander M. Pravking
e same problem several weeks ago on 7.3.3 with 4 such OR's. The final filter became monsterous, and the query was very slow. I've simply rewritten the query using UNION, and it became much faster. -- Fduch M. Pravking ---(end of broadcast)--

Re: [SQL] Backup of multiple tables

2003-09-19 Thread Alexander M. Pravking
b2" without success. Here's a perl script I used to dump all the tables separately. I'm not sure most of options do work there, I didn't test ;-) It won't be hard to make it dump certain tables, I think. -- Fduch M. Pravking dump.pl Description: Perl program

Re: [SQL] Backup of multiple tables

2003-09-19 Thread Alexander M. Pravking
dumped from the script before and release them after dump is complete... But there could be dead-lock conditions. What will gurus say? -- Fduch M. Pravking ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] STRICT function returning a composite type

2003-11-13 Thread Alexander M. Pravking
x27;-infinity', 'yesterday', 'today', 'infinity'); sdate | edate ---+--- | (1 row) Is it possible without returning SETOF ts_bounds? fduch=# SELECT version(); version -----

Re: [SQL] STRICT function returning a composite type

2003-11-13 Thread Alexander M. Pravking
arguments; > instead a NULL result is assumed automatically. Does "NULL result" mean an empty rowset if the function returns a record? -- Fduch M. Pravking ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] STRICT function returning a composite type

2003-11-13 Thread Alexander M. Pravking
On Thu, Nov 13, 2003 at 12:27:58PM -0500, Tom Lane wrote: > "Alexander M. Pravking" <[EMAIL PROTECTED]> writes: > > Does "NULL result" mean an empty rowset if the function returns a record? > > No, it means a null record. "Empty rowset" w

Re: [SQL] STRICT function returning a composite type

2003-11-13 Thread Alexander M. Pravking
On Thu, Nov 13, 2003 at 12:35:41PM -0500, Tom Lane wrote: > "Alexander M. Pravking" <[EMAIL PROTECTED]> writes: > > Very well then... Can I return a null record from such function > > explicitly? Sorry, I could't find it anywhere in docs or examples. > >

[SQL] Validity check in to_date?

2003-11-27 Thread Alexander M. Pravking
find a workaround now and will appreciate any help. fduch=# SELECT version(); version - PostgreSQL 7.3.4 on i386-portbld-freebsd4.8, compiled by GCC 2.95.4 -- Fduch M. Pravking

Re: [SQL] Validity check in to_date?

2003-12-02 Thread Alexander M. Pravking
rought up. > You may search the archives on "date plausibility" are related terms. I'm sure too, but it's really hard to find a good keyword sequence when searching such sort of things :( Anyway, thank you for attention. -- Fduch M. Pravking ---

Re: [SQL] Validity check in to_date?

2003-12-02 Thread Alexander M. Pravking
less optimistic with this: > > # select '31.11.2003'::date; > ERROR: date/time field value out of range: "31.11.2003" Exactly! But date_in formats are too limited and "floaty", especially in 7.3 or less. -- Fduch M. Pravking ---(end o

Re: [SQL] Validity check in to_date?

2003-12-02 Thread Alexander M. Pravking
but there's one from text to date. Try using check (VALUE::text::date). -- Fduch M. Pravking ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL] Validity check in to_date?

2003-12-02 Thread Alexander M. Pravking
On Tue, Dec 02, 2003 at 01:55:06PM +0300, Alexander M. Pravking wrote: > Try using check (VALUE::text::date). Assuming check expects boolean result, it's (VALUE::text::date IS NOT NULL) -- Fduch M. Pravking ---(end of broadcast)--- TIP

Re: [SQL] Problem with intervals

2003-12-02 Thread Alexander M. Pravking
this moment), but noone took a shot at it, AFAIK. Note also, that in 7.3 "timestamp" means "timestamp without time zone", while in 7.2 it's "timestamp with time zone". -- Fduch M. Pravking ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

[SQL] Materialized View Summary

2004-02-24 Thread Jonathan M. Gardner
ner [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAO3eZqp6r/MVGlwwRAnpEAKC8+/lFyPBbXetPEfFLwgUvJZLCmgCfYlmR 0vZmCcbGSNT/m/W8QOIhufk= =snCu -END PGP SIGNATURE- ---(end of broadcast)--- TIP 9: the pl

Re: [HACKERS] [SQL] Materialized View Summary

2004-02-25 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm not sure if my original reply made it through. Ignore the last one if it did. On Tuesday 24 February 2004 1:48 pm, Robert Treat wrote: > On Tue, 2004-02-24 at 12:11, Richard Huxton wrote: > > On Tuesday 24 February 2004 16:

Re: [SQL] query optimization

2004-03-05 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 04 March 2004 9:56 am, Charles Hauser wrote: > All, > > I have the following query which is running quite slow on our server > and was hoping someone would have suggestions how I might improve it. > Might want to try emailing the performan

Re: [SQL] Triggers

2004-03-05 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 26 February 2004 2:18 am, Philip J. Boonzaaier wrote: > The technical reference gives an example of a trigger on a table - > employee Just to test this, I have created the following table, > CREATE TABLE employee > (name VARCHAR(30), > age

Re: [SQL] VIEW on lookup table

2004-03-05 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 27 February 2004 2:18 pm, JJ Gabor wrote: > Hello all, > > I have a lookup table consisting of 100,000+ rows. > > 99% of the lookup values resolve to 'Unknown'. > > Building the lookup table takes a long time. > > I would like to remove the '

Re: [SQL] Break a report in Run Time

2004-03-11 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 11 March 2004 9:11 am, Jander wrote: > I need to abort the SQL process running in DB Server. > If you are in psql, you can cancel any query with CTRL-C. Otherwise, you can kill the process running the query using the "kill" c

[SQL] Row count after SELECT INTO?

2004-04-07 Thread Alexander M. Pravking
third? I tried to GET DIAGNOSTICS nrows = ROW_COUNT, bit it seems to get only value of 0 or 1. Is this how it supposed to be when SELECTing INTO a single variable? The only way I see now is a FOR ... IN SELECT loop, and I woner if there is a simpler solution. Could you please help me? -- Fduch M

[SQL] Memory usage on subselect

2004-05-22 Thread Alexander M. Pravking
s2.edate > now(); Seq Scan on services s2 (cost=0.00..56.08 rows=1 width=0) (actual time=177.01..177.01 rows=0 loops=1) Filter: ((id <> 561) AND (sreq(id, 'ipacct_ip'::text, now()) = sreq(561, 'ipacct_ip'::text, now())) AND (sdate < now()) AND (edate > now())) Total

Re: [SQL] Memory usage on subselect

2004-05-23 Thread Alexander M. Pravking
On Sun, May 23, 2004 at 12:28:18PM -0400, Tom Lane wrote: > "Alexander M. Pravking" <[EMAIL PROTECTED]> writes: > > I've got a memory usage problem when I try to do a subselect on the same > > table as the main select (PostgreSQL 7.3.4 on FreeBSD). Here's m

Re: RES: [SQL] Datetime problem

2004-06-14 Thread Alexander M. Pravking
s timestamp WITH time zone. This is probably a documentation bug... -- Fduch M. Pravking ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] feature request ?

2004-06-24 Thread Alexander M. Pravking
?column? -- (0 rows) So if you care, you SHOULD use IS [NOT] NULL, as Michael Glaesemann suggested. If you don't want expression to be calculated twice, use a temporary variable. -- Fduch M. Pravking ---(end of broadcast)--- TIP 1: s

[SQL] UPDATE ... WHERE (subselect on the same table)

2004-06-29 Thread Alexander M. Pravking
used here will work correctly, i.e. will the "test.name" always refer the column in outer table, not inner (t2)? Thanks in advance. -- Fduch M. Pravking ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] UPDATE ... WHERE (subselect on the same table)

2004-06-29 Thread Alexander M. Pravking
When an alias is provided, it completely hides the actual name of the table or table function; /me should RTFM... (repeating hundred times) -- Fduch M. Pravking ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

[SQL] Indexable (constant LIKE prefix_keyfield) ?

2004-07-14 Thread Alexander M. Pravking
l' AND 'literal' LIKE prefix || '%' ORDER BY prefix DESC LIMIT 1; Looks like the best way, but I'm not sure this is always correct. Comments, suggestions, please? -- Fduch M. Pravking ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL] Problem in age on a dates interval

2004-07-19 Thread Alexander M. Pravking
e Petrosky <[EMAIL PROTECTED]> writes: > > > > > >>wow at first I thought I had my head around a leap > >>year problem so I advanced your query a year > >> > >> > > > >I think what's going on here is a difference of i

[SQL] HOW TO HANDLE ZEROS IN DATE FIELD?

2004-09-10 Thread James M Doherty
e have experience in solving this problem. The other alternative I thought of was to write a trigger to fix it ?? James M Doherty [EMAIL PROTECTED] Georgetown, TX 78626 "There is no luck without discipline" IRISH PROVERB ---(end of broadcast)---

Re: [SQL] CHECK col A not NULL if col B='x'

2004-09-28 Thread Alexander M. Pravking
constraint "test_a" [EMAIL PROTECTED] INSERT INTO test VALUES (1, 'x'); INSERT 107539 1 -- Fduch M. Pravking ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] TEXT::CIDR/INET::CIDR output confusion

2004-11-12 Thread Alexander M. Pravking
uch=# SELECT version(); version PostgreSQL 7.4.5 on i386-portbld-freebsd5.3, compiled by GCC cc (GCC) 3.4.2 [FreeBSD] 20040728 -- Fduch M. Pravking --

[SQL] Question about update syntaxt

2005-04-29 Thread Michael M Friedel
igure that will make Postgresql accept these kind of statments ? ---- Michael M Friedel Research & Development ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] 'select where' using multiple columns.

2005-08-05 Thread Hélder M. Vieira
;%String%' OR surname LIKE '%String%' Helder M. Vieira ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Fwd: How to encrypt a column

2005-08-11 Thread Hélder M . Vieira
rypted column be of type "text" ? I'd check a previous critical point ... The encrypt() function output. What is the range of characters in encrypt() output ? Control, null or false escape characters, if not properly escaped, could be misleading either sprintf or t

Re: [SQL] table listing queries

2005-08-25 Thread Hélder M . Vieira
probably happens because of the need for some kind of unified repository of objects pertaining to different database engines. Helder M. Vieira ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

  1   2   >