Re: [GENERAL] Extract last 4 characters from string?

2007-12-12 Thread Rodrigo De León
On Dec 12, 2007 4:11 PM, D. Dante Lorenso <[EMAIL PROTECTED]> wrote: > Is there an easy (preferred) method that I'm missing? select substring('ABCDEFGHIJKLMNOP' from '$'); ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [GENERAL] LIBPQ Exception

2007-12-12 Thread Rodrigo De León
On Dec 12, 2007 7:36 AM, Abraham, Danny <[EMAIL PROTECTED]> wrote: > Any other alternative? There are no anonymous blocks in PostgreSQL: You could try creating a function: create or replace function shootmyselfinthefoot() returns boolean as $$ declare (...); begin execute 'SOME DML HERE';

Re: [GENERAL] Trigger - will not perform INSERT

2007-12-11 Thread Rodrigo De León
On Dec 11, 2007 3:35 PM, smiley2211 <[EMAIL PROTECTED]> wrote: > Thanks...Michelle Please post DDL plus sample code/data to increase the odds of having someone help you. ---(end of broadcast)--- TIP 4: Have you searched our list archives?

Re: [GENERAL] TIMESTAMP difference

2007-12-10 Thread Rodrigo De León
On Dec 10, 2007 2:13 PM, rihad <[EMAIL PROTECTED]> wrote: > Hi, is there a way to get the difference in hours between two > timestamps? SELECT (EXTRACT (EPOCH FROM TIMESTAMP '20071211 00:00') - EXTRACT (EPOCH FROM TIMESTAMP '20071209 01:00')) * INTERVAL '1 second'; ---(end

Re: [GENERAL] Array index not used for query on first element?

2007-12-07 Thread Rodrigo De León
On Dec 7, 2007 4:12 PM, John D. Burger <[EMAIL PROTECTED]> wrote: > This is under 7.4. Urgh! > Is this different on less paleolithic versions of > PG, or is there some other issue? Same here: select version(); PostgreSQL 8.3beta4, compiled by Visual C++ build 1400 select * from temppaths where

Re: [GENERAL] Q: using generate_series to fill in the blanks

2007-12-06 Thread Rodrigo De León
On Dec 6, 2007 10:44 PM, Ow Mun Heng <[EMAIL PROTECTED]> wrote: > I've got a desired output which looks something like this.. > > vdt| count > +--- > 1 | 514 > 2 |27 > 3 |15 > 4 | > 5 |12 > 6 |1

Re: [GENERAL] Create function errors

2007-12-04 Thread Rodrigo De León
On Dec 4, 2007 6:04 PM, Peck, Brian <[EMAIL PROTECTED]> wrote: > SELECT source_id as vertex INTO result FROM $3 ORDER BY > Distance(the_geom,PointFromText(POINT( $1 $2 ))) LIMIT 1; I think you're missing a comma, e.g. POINT( $1 , $2 ). ---(end of broadcast)---

[GENERAL] ERROR: failed to find conversion function from unknown to integer[]

2007-11-29 Thread Rodrigo De León
t=# select version(); version PostgreSQL 8.3beta3, compiled by Visual C++ build 1400 (1 row) t=# -- foo is of type unknown t=# select '{1,2,3}' as foo; foo - {1,2,3} (1 row) t=# -- OK. foo is of type int

Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Rodrigo De León
I wrote: > You can declare arbitrary-sized, n-dimensional arrays: Sorry, I re-read your post. You want to programatically define the array dimensions depending on function arguments. You could try building a string, then casting to the correct array type (not tested). --

Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Rodrigo De León
On Nov 29, 2007 3:34 AM, Max Zorloff <[EMAIL PROTECTED]> wrote: > According to the docs it seems that only way would be to declare it as > something like : > myArray := ARRAY[[1,2], [3,4], [5,6]]; You can declare arbitrary-sized, n-dimensional arrays: ... DECLARE myArray integer[][]; -- two-dime

Re: [GENERAL] I have a select statement on the issue.

2007-11-28 Thread Rodrigo De León
On Nov 28, 2007 1:58 AM, <[EMAIL PROTECTED]> wrote: > 1. Why the default output changes after I execute the update statement? > 2. Qustion, sorting as main keys when query, how to do? See: http://www.postgresql.org/docs/8.2/static/queries-order.html ---(end of broadcast)-

Re: [GENERAL] Table filter

2007-11-21 Thread Rodrigo De León
On Nov 21, 2007 9:21 AM, Reg Me Please <[EMAIL PROTECTED]> wrote: > Hi all. > > I've the following concept. This smells like EAV. Please read http://joecelkothesqlapprentice.blogspot.com/2006/04/using-one-table-vs-many.html and consider reevaluating the schema according to valid relational de

Re: [GENERAL] Populating large DB from Perl script

2007-11-05 Thread Rodrigo De León
On 11/3/07, Mikko Partio <[EMAIL PROTECTED]> wrote: > On Nov 2, 2007 8:45 PM, Kynn Jones <[EMAIL PROTECTED]> wrote: > It would be great if there was a stored proc-archive somewhere in the > web where people could post their procedures. I know there are some > code examples in the official documenta

Re: [GENERAL] newbie: update timestamp trigger?

2007-10-23 Thread Rodrigo De León
On 10/23/07, ahnf <[EMAIL PROTECTED]> wrote: > Whenever a row is updated in a table with a timestamp column. How do I write > a trigger to set that timestamp column to now() or the current timestamp? Straight from the horse's mouth: http://www.postgresql.org/docs/8.2/static/plpgsql-trigger.html#P

Re: [GENERAL] Array intersection

2007-10-17 Thread Rodrigo De León
On 10/17/07, Josh Trutwin <[EMAIL PROTECTED]> wrote: > nm - I just wrote a function - though curious if this is the most > effecient way: If you only want TRUE or FALSE, you can use '&&': t=# SELECT '{1,2}'::INT[] && '{2,3}'::INT[]; ?column? -- t (1 row) ---(end

Re: [GENERAL] Query problem

2007-10-12 Thread Rodrigo De León
On 10/12/07, Clemens Schwaighofer <[EMAIL PROTECTED]> wrote: > I probably need to approach the problem different. So both are read > "independent" or something like this. Also, email_a, email_b, etc. indicate that you need to consider refactoring your schema. You can find a lot of tutorials on no

Re: [GENERAL] good sql tutorial

2007-10-04 Thread Rodrigo De León
On 10/4/07, Geoffrey <[EMAIL PROTECTED]> wrote: > Stating the obvious google search to me is just as rude. I was looking > for recommendations based on others' experiences. That was not my intention, so I'm sorry if you felt that way. Peace. ---(end of broadcast)

Re: [GENERAL] good sql tutorial

2007-10-04 Thread Rodrigo De León
On 10/4/07, Geoffrey <[EMAIL PROTECTED]> wrote: > I know how to use google, I'm looking for recommendations. What an ass. If you found my reply to be lacking, you can say so without being rude... ---(end of broadcast)--- TIP 2: Don't 'kill -9' the

Re: [GENERAL] good sql tutorial

2007-10-04 Thread Rodrigo De León
On 10/4/07, Geoffrey <[EMAIL PROTECTED]> wrote: > Anyone have a recommendation for a good sql tutorial? Looking for a > book, but online would be useful as well. > > This is for a financial user who will need to have an understanding of > sql in order to generate reports with a report writer like

Re: [GENERAL] Unexpected behavior with CASE statement

2007-10-03 Thread Rodrigo De León
On 10/3/07, Jimmy Choi <[EMAIL PROTECTED]> wrote: > I expect to get the following result set: > > metric_type | result > +--- > 0 | 2 > 1 | 3 Try: SELECT metric_type , SUM(CASE metric_type WHEN 0 THEN 1 / val

Re: [GENERAL] Select too many ids..

2007-10-02 Thread Rodrigo De León
On 10/1/07, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I have a id list and id list have 2 million dinamic elements.. > I want to select what id have point.. > I try: > > SELECT id, point FROM table WHERE id in (IDLIST) > > This is working but too slowly and i need to performance.. > > I'm sorry

Re: [GENERAL] "not in" clause too slow?

2007-09-21 Thread Rodrigo De León
On 9/21/07, Ottavio Campana <[EMAIL PROTECTED]> wrote: > My problem is that if I run the same command on another > table with 378415 rows, it is terribly slow. How much is "terribly slow"? Did you VACUUM ANALYZE? Anyways, try this: SELECT * FROM MYTABLE T1 LEFT JOIN COPY_MYTABLE T2 ON T1.ID = T

Re: [GENERAL] ON INSERT => execute AWK/SH/EXE?

2007-09-18 Thread Rodrigo De León
On 9/17/07, Bima Djaloeis <[EMAIL PROTECTED]> wrote: > Thanks for reading, any help is appreciated. Triggers + Untrusted PL/Perl, see: 1) http://www.postgresql.org/docs/8.2/static/plperl-triggers.html 2) http://www.postgresql.org/docs/8.2/static/plperl-trusted.html ---(end

Re: [GENERAL] Recall: August Monthly techdata split fi

2007-09-18 Thread Rodrigo De León
On 9/18/07, Geoffrey <[EMAIL PROTECTED]> wrote: > In my experience, attempting to 'recall' an email message is a fruitless > endeavor. Seems to me that this is a 'Microsoft' creation. I really > don't understand the purpose, because by the time you consider > 'recalling' the email message, it's a

Re: [GENERAL] For index bloat: VACUUM ANALYZE vs REINDEX/CLUSTER

2007-09-18 Thread Rodrigo De León
On 9/18/07, Ow Mun Heng <[EMAIL PROTECTED]> wrote: > On Tue, 2007-09-18 at 06:01 -0400, Bill Moran wrote: > > * (with newer version) reduce the fill factor and REINDEX > > What is fill factor? See "Index Storage Parameters": http://www.postgresql.org/docs/8.2/static/sql-createindex.html -

Re: [GENERAL] How to recover database instance from a disaster

2007-09-14 Thread Rodrigo De León
On 9/14/07, Chansup Byun <[EMAIL PROTECTED]> wrote: > Is there any other way? See: http://www.postgresql.org/docs/8.2/static/backup.html ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an i

Re: [GENERAL] Locking entire database

2007-09-14 Thread Rodrigo De León
On 9/14/07, Panagiotis Pediaditis <[EMAIL PROTECTED]> wrote: > ... there is a specific case where i need it. Don't really know, but, explain what the case is, and maybe someone could help you. ---(end of broadcast)--- TIP 4: Have you searched our li

Re: [GENERAL] query help

2007-09-13 Thread Rodrigo De León
On 9/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > query is?? http://www.w3schools.com/sql/default.asp ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PR

Re: [GENERAL] Cannot declare record members NOT NULL

2007-09-12 Thread Rodrigo De León
On 9/12/07, Cultural Sublimation <[EMAIL PROTECTED]> wrote: > Thanks for the help! Not really following you, but try these: CREATE OR REPLACE FUNCTION GET_MOVIES () RETURNS SETOF MOVIES LANGUAGE SQL STABLE AS $$ SELECT MOVIE_ID, MOVIE_NAME FROM MOVIES; $$; -- OR -- CREATE OR REPLACE FUNCTION GE

Re: [GENERAL] oracle rank() over partition by queries

2007-09-11 Thread Rodrigo De León
On 9/11/07, sharmi Joe <[EMAIL PROTECTED]> wrote: > Hi, > Is there a way to get the oracle's rank() over partition by queries in > postgresql? For example if I have a query like > > Select Col1, Col2, RANK() OVER(PARTITION BY Col1 order by Col3 desc) as rank > from table1 > > Thanks in advance See

Re: [GENERAL] avg() of array values

2007-09-11 Thread Rodrigo De León
On 9/11/07, Alban Hertroys <[EMAIL PROTECTED]> wrote: > I would have expected an avg of 2.0 and a sum of 4, where am I going wrong? This works for me: select avg(a) from explode_array(array[1, 3]) a; avg 2. (1 row) ---(end of

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Rodrigo De León
Remove the ", 0 AS ajaa", that was some filler that got thru by mistake. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Rodrigo De León
On 9/11/07, Jeff Lanzarotta <[EMAIL PROTECTED]> wrote: > I appreciate the help... SELECT TO_CHAR(ts, 'MM/DD/') AS "day", str, proc , SUM(CASE WHEN z <> 0 THEN 1 ELSE 0 END) AS good, 0 AS ajaa , SUM(CASE

Re: [GENERAL] audit sql queries

2007-09-10 Thread Rodrigo De León
On 9/9/07, Dan99 <[EMAIL PROTECTED]> wrote: > Any help with this would be greatly appreciated. http://www.postgresql.org/docs/8.2/static/plpgsql-trigger.html#PLPGSQL-TRIGGER-AUDIT-EXAMPLE ---(end of broadcast)--- TIP 4: Have you searched our list ar

Re: [GENERAL] an other provokative question??

2007-09-08 Thread Rodrigo De León
On 9/7/07, Greg Smith <[EMAIL PROTECTED]> wrote: > ... renaming the database "Horizontica". Following the naming convention, wouldn't it be "Horizonta"? ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate

Re: [GENERAL] What is the best way to merge two disjoint tables?

2007-09-07 Thread Rodrigo De León
On 9/7/07, Chansup Byun <[EMAIL PROTECTED]> wrote: > One more question: Is there a way to make the T2.U_ID + 1000 number to be > incremental from a given number instead of adding 1000? See here: http://archives.postgresql.org/pgsql-sql/2007-05/msg00194.php Then, say we want to start from 49:

Re: [GENERAL] What is the best way to merge two disjoint tables?

2007-09-07 Thread Rodrigo De León
On 9/7/07, Chansup Byun <[EMAIL PROTECTED]> wrote: > Can someone show me an example SQL statement? I suppose you could add a constant, non-overlapping number to add to the duplicate IDs, say 1000, and then this: SELECT COALESCE(T1.U_USER, T2.U_USER) AS U_USER , COALESCE(CASE

Re: [GENERAL] stored procedure

2007-09-07 Thread Rodrigo De León
On 9/7/07, genesis <[EMAIL PROTECTED]> wrote: > appreciate any help, links etc... See: http://www.postgresql.org/docs/8.2/static/xfunc-sql.html#AEN36437 ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Querying database for table pk - better way?

2007-09-05 Thread Rodrigo De León
Sorry, just realized that I misread the query's requirements, but you can play with PG's system catalogs to complete it. See: http://www.postgresql.org/docs/8.1/static/catalogs.html ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Querying database for table pk - better way?

2007-09-05 Thread Rodrigo De León
On 9/5/07, Josh Trutwin <[EMAIL PROTECTED]> wrote: > Curious if there is a better/cheaper way to get the data I'm looking > for though? SELECT conname FROM pg_constraint c JOIN pg_class l ON c.conrelid = l.relfilenode JOIN pg_namespace n ON n.OID = l.relnamespace WHERE contype = 'p' A

Re: [GENERAL] now() vs current_user

2007-09-05 Thread Rodrigo De León
On 9/5/07, Ottó Havasvölgyi <[EMAIL PROTECTED]> wrote: > What is the cause that "now()" works but "now" does not and > "current_user" works but "current_user()" does not. From http://www.postgresql.org/docs/8.2/static/functions-info.html : "Note: current_user, session_user, and user have special

Re: [GENERAL] Partition Reindexing

2007-09-05 Thread Rodrigo De León
On 9/4/07, Nik <[EMAIL PROTECTED]> wrote: > This is on PostgreSQL 8.1.3 on Windows 2003 Advanced Server. Only 8.2 or newer has CREATE INDEX CONCURRENTLY. Maybe you could schedule a maintenance window for this. ---(end of broadcast)--- TIP 5: don't

Re: [GENERAL] SELECT question (splitting a field)

2007-09-04 Thread Rodrigo De León
On 9/4/07, Madison Kelly <[EMAIL PROTECTED]> wrote: >I am sure I am missing something simple. :) Yeah... '[EMAIL PROTECTED]' <> '@test.com' ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] return 1 formatted result instead of multiple results

2007-09-02 Thread Rodrigo De León
On 8/31/07, Acm <[EMAIL PROTECTED]> wrote: > and I want one result to be "Mike,John,Dennis". SELECT ARRAY_TO_STRING(ARRAY(SELECT * FROM PEOPLE),',') AS FOO ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] how to print a schema

2007-08-29 Thread Rodrigo De León
On 8/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Does anybody know how to print a schema in PostgreSQL? I know you can > look at one table at at time, but is there a way to print all columns > and rows at once? 1. pg_dump / pg_dumpall http://www.postgresql.org/docs/8.2/static/backup-d

Re: [GENERAL] Is there a better way to do this?

2007-08-28 Thread Rodrigo De León
On 8/28/07, Wei Weng <[EMAIL PROTECTED]> wrote: > Is there a more concise way to do this? CREATE OR REPLACE FUNCTION ADDDAYS (TIMESTAMP WITHOUT TIME ZONE, INT) RETURNS TIMESTAMP WITHOUT TIME ZONE AS ' SELECT $1+($2 * ''1 DAY''::INTERVAL) ' LANGUAGE SQL; ---(end of broadcas

Re: [GENERAL] problem Linking a TTable component to a pgsql view using BCB5

2007-08-23 Thread Rodrigo De León
On 8/21/07, JLoz <[EMAIL PROTECTED]> wrote: > I have not been able to find a workaround for this? Does the table have a unique index/primary key? ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Function with Integer array parameter

2007-08-16 Thread Rodrigo De León
On Aug 16, 11:06 am, [EMAIL PROTECTED] (Ranjan Kumar Baisak) wrote: > Decibel! wrote: > > On Thu, Aug 16, 2007 at 11:14:25AM -0400, Ranjan Kumar Baisak wrote: > > >> Postgres Gurus, > >> Please suggest me what is wrong with this > >> function. > >> This function tries to

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-16 Thread Rodrigo De León
On Aug 16, 5:19 am, [EMAIL PROTECTED] (Decibel!) wrote: > On Thu, Aug 16, 2007 at 12:12:03PM +0200, Rainer Bauer wrote: > > "Scott Marlowe" wrote: > > But if you go to eBay, they always give you an accurate count. Even if the > > no. > > of items found is pretty large (example:

Re: [GENERAL] Fastest way to import only ONE column into a table? (COPY doesn't work)

2007-08-15 Thread Rodrigo De León
On Aug 15, 11:46 pm, [EMAIL PROTECTED] ("Phoenix Kiula") wrote: > Appreciate any tips, because it would > be nasty to have to do this with millions of UPDATE statements! - Create an interim table - COPY the data into it - Do an UPDATE ... FROM ... ---(end of broadcast)---

Re: [GENERAL] Trigger not working as expected, first row gets a null value

2007-08-08 Thread Rodrigo De León
On Aug 8, 3:20 pm, [EMAIL PROTECTED] (novnov) wrote: > ... I also don't understand ... DDL + sample data, please... ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org/

Re: [GENERAL] Select question..... is there a way to do this?

2007-08-03 Thread Rodrigo De León
On Aug 3, 11:17 pm, [EMAIL PROTECTED] (Karl Denninger) wrote: > Ideas? SELECT item.user, item.subject, item.number FROM item, seen WHERE item.user = seen.user AND item.number = seen.number AND item.changed > seen.lastviewed UNION SELECT item.user, item.subject, item.number FROM item, se

Re: [GENERAL] Optimising SELECT on a table with one million rows

2007-07-30 Thread Rodrigo De León
On Jul 30, 12:01 pm, [EMAIL PROTECTED] (Cultural Sublimation) wrote: > Hash Join (cost=28.50..21889.09 rows=988 width=14) (actual > time=3.674..1144.779 rows=1000 loops=1) >Hash Cond: ((comments.comment_author)::integer = (users.user_id)::integer) >-> Seq Scan on comments (cost=0.00..218

Re: [GENERAL] Count(*) throws error

2007-07-11 Thread Rodrigo De León
On Jul 11, 4:00 pm, [EMAIL PROTECTED] ("Jasbinder Singh Bali") wrote: > I don't know why isn't count(*) working Works for me: create table tbl_concurrent(a int); insert into tbl_concurrent values (1); insert into tbl_concurrent values (9); insert into tbl_concurrent values (4); create or replace

Re: [GENERAL] Simple backup utility like mysqldump?

2007-06-29 Thread Rodrigo De León
On Jun 29, 12:32 am, Bjorn Boulder <[EMAIL PROTECTED]> wrote: > Hello People, > > I'm running PostgreSQL 8.1.1 on my freebsd box. > > I'm curious if PostgreSQL has a utility for backing up small databases > like mysqldump or Oracle's export utility. > > -b See: http://www.postgresql.org/docs/8.2/s

Re: [GENERAL] Need help with generic query

2007-06-20 Thread Rodrigo De León
On Jun 20, 5:55 am, David Abrahams <[EMAIL PROTECTED]> wrote: > The problem is, psql is complaining: > > ERROR: wrong record type supplied in RETURN NEXT Try: ... RETURNS SETOF RECORD ... ---(end of broadcast)--- TIP 1: if posting/reading throu

Re: [GENERAL] Why does this work?

2007-06-15 Thread Rodrigo De León
On Jun 15, 1:56 pm, [EMAIL PROTECTED] ("Ian Harding") wrote: > I accidentally formatted a string for tsearch before trying to cast it > to a date, and it worked! > > select 'June&15&2007'::date > date > > 2007-06-15 > (1 row) > > Is this a happy accident, or is it OK to count on

Re: [GENERAL] Historical Data Question

2007-06-14 Thread Rodrigo De León
On Jun 14, 12:57 pm, Lza <[EMAIL PROTECTED]> wrote: > Can anyone help me with this problem? > > I have a table in my database that holds information on policies and > this table is linked to a number of other tables. I need to be able to > keep a history of all changes to a policy over time. The ot

Re: [GENERAL] Regular expressions in procs

2007-06-13 Thread Rodrigo De León
On Jun 13, 9:02 am, [EMAIL PROTECTED] (Steve Manes) wrote: > I apologize if I'm having a rookie brain block, but is there a way to > massage a string inside a proc to, for instance, strip it of all > non-alpha characters using a regular expression? regexp_replace() could work for you, see: http://

Re: [GENERAL] pointer to feature comparisons, please

2007-06-13 Thread Rodrigo De León
On Jun 13, 8:57 am, [EMAIL PROTECTED] (Kevin Hunter) wrote: > So, motivation aside, what I'm wanting is a couple of pointers to > feature comparisons of Postgres vs Oracle. What else is going to > bite him while he works on this project? Would be handy to have this > reference since neither of us

Re: [GENERAL] parametered views

2007-06-09 Thread Rodrigo De León
On Jun 8, 7:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > i have 4 tables : > > date_table (date_id,.) > A_table(A_table_id, something1,something2.) > A1_table(A1_table_id references A_Table(A_Table_id),A11,A12) > A2_table(A2_table_id references A_Table(A_table_id),A21

Re: [GENERAL] parametered views

2007-06-08 Thread Rodrigo De León
[EMAIL PROTECTED] ha escrito: > Hello, > > my problem is : in depend of the value of a field in a table A, I > want to select other fields coming from a table B, or a table C. > > I want to know if it's possible to create a parametred view in > postgresql to resolve this problem > > > Thx, > Lhaj

Re: [GENERAL] list all columns in db

2007-06-07 Thread Rodrigo De León
Jonathan Vanasco ha escrito: > Does anyone have a trick to list all columns in a db ? SELECT * FROM INFORMATION_SCHEMA.COLUMNS ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan

Re: [GENERAL] SELECT from mytbl;

2007-05-29 Thread Rodrigo De León
On May 29, 11:35 pm, Erwin Brandstetter <[EMAIL PROTECTED]> wrote: > EXECUTE > 'SELECT ' > || (SELECT array_to_string(ARRAY( > SELECT a.attname > FROM pg_class c, pg_namespace nc, pg_attribute a > WHERE c.relname = 'v_event' >AND c.relnamespace = nc.oid >AND nc.nspname = 'stdat' >AND

Re: [GENERAL] SELECT from mytbl;

2007-05-29 Thread Rodrigo De León
On May 29, 5:42 pm, [EMAIL PROTECTED] wrote: > Hi! > > Title says it pretty much. I am wondering if there is a short way to > form a query that retrieves all fields of a table (of which I do not > know names and number beforehand) except for one (or more, of which I > know the name(s)). I have stum

Re: [GENERAL] How to create trigger if it does not exist

2007-05-27 Thread Rodrigo De León
On May 26, 5:58 pm, "Andrus" <[EMAIL PROTECTED]> wrote: > Thank you. > This doc says that dropping trigger drops depending objects also. Only if you use CASCADE (default is RESTRICT). ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] How to create trigger if it does not exist

2007-05-26 Thread Rodrigo De León
Andrus ha escrito: > CREATE TRIGGER mycheck_trigger BEFORE INSERT OR UPDATE ON mytbl > FOR EACH ROW EXECUTE PROCEDURE mycheck_pkey(); > > aborts transaction if trigger already exists. > > There in no CREATE OR REPLACE TRIGGER command in PostgreSQL > > How to create trigger only when it does not

Re: [GENERAL] Limiting number of rows returned at a time in select query

2007-05-24 Thread Rodrigo De León
Jon Clements ha escrito: > Hi All. > > Is there a way inside a query (or connection) to limit the amount of > records returned each chunk by the server? At the moment, I have 22 > million records trying to be returned in one-go as the result set. I > have a .NET driver that has a FetchSize option w

Re: [GENERAL] doverlaps() returns null

2007-05-21 Thread Rodrigo De León
On May 21, 4:49 am, "Andrus" <[EMAIL PROTECTED]> wrote: > I'm using this for emplyment, vacation, illness etc. period calculation. > OVERLAPS produces invalid result in this case for DATE as discussed in other > thread. > > select doverlaps(date '2007-01-01',date '2007-01-02',date '2007-01-02',date

Re: [GENERAL] doverlaps() returns null

2007-05-21 Thread Rodrigo De León
On May 20, 1:39 pm, "Andrus" <[EMAIL PROTECTED]> wrote: > I need to check when two date intervals overlap. > Some date interval values may be null. > > I created the following function but > > select doverlaps( null, null, null, null); > > returns null. > > How to fix this so that null values are a

Re: [GENERAL] How to implement GOMONTH function

2007-05-13 Thread Rodrigo De León
Andrus ha escrito: > I need to create function GOMONTH which returns date by given number of > month before or forward using sql or pgsql in 8.1+ > For example, > GOMONTH( DATE '20070513', 1 ) should return date '20070613' > GOMONTH( DATE '20070513', -2 ) should return date '20070313' > > I tried

Re: [GENERAL] Indice en Date

2007-05-13 Thread Rodrigo De León
Arturo Munive ha escrito: > tengo un indice sobre una columna date. > > cuando hago una consulta ... > *Select * > id > *from * > ventas > *WHERE * > fecha = date('12-JAN-2007') > > el planificador usa el indice > > pero cuando la restriccion es WHERE fecha < date('12-JAN-2007'