Re: [SQL] Unique index and unique constraint

2013-07-26 Thread Alvaro Herrera
JORGE MALDONADO escribió: > I guess I am understanding that it is possible to set a unique index or a > unique constraint in a table, but I cannot fully understand the difference, > even though I have Google some articles about it. I will very much > appreciate any guidance. The SQL standard does

Re: [SQL] Unquoted column names fold to lower case

2013-07-03 Thread Alvaro Herrera
Dev Kumkar escribió: > But what I am asking here is if an alias name is provided be it upper case, > lower case, or a mix then shouldn't it be preserved as as it is given. All > this talk is when alias names are unquoted, when quoted then its standard > behavior as seen in other databases. Aliase

Re: [SQL] regexp_replace behavior

2012-11-20 Thread Alvaro Herrera
Marcin Krawczyk escribió: > Hi list, > > I'm trying to use regexp_replace to get rid of all occurrences of > certain sub strings from my string. > What I'm doing is: > > SELECT regexp_replace('F0301 305-149-101-0 F0302 {x1} 12W47 0635H > {tt}{POL23423423}', E'\{.+\}', '', 'g') > > so get rid of

Re: Fwd: [SQL] i want small information regarding postgres

2012-01-08 Thread Alvaro Herrera
Excerpts from Samuel Gendler's message of lun ene 02 08:44:53 -0300 2012: > would someone with the appropriate authority please unsubscribe this > person's email address from this list so we don't all get a bounce message > after every email we send to the list? Thanks. Just did it. In the futu

Re: [SQL] 9.0rc1 - query of view produces unexpected results

2010-09-13 Thread Alvaro Herrera
Excerpts from Nathan Grange's message of sáb sep 11 21:31:04 -0400 2010: > Hello list, > > I don't know if it's me, or maybe even the way I designed these > dependencies, but I'm getting unexpected results when i query a specific > view. > Included are a buildDemo.sql file that will create th

Re: [SQL] How do you do the opposite of regexp_split_to_table?

2010-08-03 Thread Alvaro Herrera
Excerpts from John Gage's message of mar ago 03 16:21:58 -0400 2010: > Grouping by summing numerical fields seems to be straightforward, but > grouping by concatenating text fields escapes my search of the > documentation. You can create a new custom aggregate function that does this. It's p

Re: [SQL] WAL-files restore and nextval('PK')

2010-05-03 Thread Alvaro Herrera
alues jump to the logged values, which are necessarily higher than the values they last delivered before the crash. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-sql mailing list (pgsql-sql@postgr

Re: [SQL] Is there any function to test for numeric ips?

2009-12-11 Thread Alvaro Herrera
ame but that should get you started. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- 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] get sequence name from table name

2009-12-04 Thread Alvaro Herrera
Uwe Maiwald wrote: > how to get the name of the sequence that is responsible for setting > the autoincrement value of a tables primary key column? You can use the pg_get_serial_sequence() function. You need the name of the column in addition to the table name though. -- Alvaro H

Re: [SQL] [GENERAL] Data audit trail techniques in postgresql

2009-08-27 Thread Alvaro Herrera
Rob Sargent escribió: > tablelog doesn't appear any more lively than the OPs audittrail2. Perhaps, but I have heard of people using it successfully recently, whereas Nathaniel reported that audittrail2 seems to have obvious bugs. -- Alvaro Herrera

Re: [SQL] [GENERAL] Data audit trail techniques in postgresql

2009-08-27 Thread Alvaro Herrera
Nathaniel Smith wrote: > What do others use to accomplish this? Do most pg users just write > triggers by hand? Or is there some nice auditing module that Google > just isn't revealing to me? I think tablelog (to be found in pgfoundry too) is the most commonly used audit modul

Re: [SQL] mail alert

2009-08-13 Thread Alvaro Herrera
ur system is going to be receiving notifications fairly frequently, it is probably better to stay with polling. (This is what Skype's replication system does, and Hannu Krossing says "what, are you going to optimize for the time when the server is idle?") -- Alvaro Herrera

Re: [SQL] mail alert

2009-08-13 Thread Alvaro Herrera
27;t block the database system just because your mail server is down - the email can be sent on whatever schedule fits the listener program - the listener client can run elsewhere, not only in the database server - any further external processing can take place at that time, wit

Re: [SQL] Bit by "commands ignored until end of transaction block" again

2009-07-24 Thread Alvaro Herrera
is context not all transactions are equal :-( (The problem, as we found out, is that the function must always have control at the same level of transaction nestedness in SPI; you can't just let the user define and release savepoints arbitrarily.) -- Alvaro Herrera

Re: [SQL] function returning a cursor and a scalar

2009-07-13 Thread Alvaro Herrera
ram and then make the function > explicitly RETURN a refcursor? Why wouldn't you just use two OUT params? BTW how do you plan on returning the number of matches? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Devel

Re: [DOCS] [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Alvaro Herrera
Bruce Momjian escribió: > Alvaro Herrera wrote: > > I don't know about Roberto Mello's site. Did we get a copyright > > transfer or a license saying we could use the contents? > > Nope, but I assumed it was BSD-licensed. I see this Josh Berkus > copyright: >

Re: [SQL] proposal for a CookBook in postgresql.org

2009-06-02 Thread Alvaro Herrera
ight transfer or a license saying we could use the contents? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to yo

Re: [SQL] proposal for a CookBook in postgresql.org

2009-05-18 Thread Alvaro Herrera
Pavel Stehule escribió: > 2009/5/18 Alvaro Herrera : > > Pavel Stehule escribió: > > > >> others tricks http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks > > > > There's a lot of good stuff in there ... would you care about > > copying

Re: [SQL] proposal for a CookBook in postgresql.org

2009-05-18 Thread Alvaro Herrera
Pavel Stehule escribió: > others tricks http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks There's a lot of good stuff in there ... would you care about copying/moving it to wiki.postgresql.org/wiki/Snippets ? -- Alvaro Herrerahttp://www.CommandPr

Re: [SQL] Distinct oddity

2009-05-12 Thread Alvaro Herrera
Maximilian Tyrtania wrote: > am 11.05.2009 16:38 Uhr schrieb Alvaro Herrera unter > alvhe...@commandprompt.com: > > >>>Note that the de_DE locale uses Latin9 encoding, which is incompatible > >>>with UTF8. > >>> I'd try checking if the proble

Re: [SQL] Distinct oddity

2009-05-11 Thread Alvaro Herrera
Maximilian Tyrtania wrote: > am 10.05.2009 4:58 Uhr schrieb Alvaro Herrera unter > alvhe...@commandprompt.com: > > I'd try checking if the problem is reproducible in > > de_DE.utf8 (you need to create a new database for testing, obviously). > > Wait a minute. I need

Re: [SQL] Distinct oddity

2009-05-09 Thread Alvaro Herrera
, obviously). If it's not, then the incompatible locale definition is causing the problem. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing list (pgsql-sql

Re: [SQL] SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps

2009-04-02 Thread Alvaro Herrera
ERLAPS operator, something like this: WHERE (start_ts, end_ts) OVERLAPS ('2008-12-07 07:59:59', '2008-12-07 08:59:59') What I'm not so sure about is how optimizable this construct is. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The Postgre

Re: [SQL] Re: [SQL] Relator io da composiçao de FKs e PKs

2009-03-19 Thread Alvaro Herrera
Oliveiros Cristina wrote: > Escreve a tua dúvida em inglês, por favor, isto é uma lista de mailing em > ingles. Isn't there a portuguese mailing list? Should one be created? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Com

Re: [SQL] Object create date

2008-12-29 Thread Alvaro Herrera
ing this. Sadly I've found it to be very fragile in > face of a careless programmer who forgets to update the tags. Myself > being the prime suspect. :) You don't update the tags. They are updated automatically by CVS (or Subversion, whatever you use) -- Alvaro Herrera

Re: [SQL] Object create date

2008-12-29 Thread Alvaro Herrera
Fernando Hevia escribió: Hi, > I'm having a hard time trying to find out if the latest patches have > been applied to my application (uses lots of pgplsql functions). > Does Postgres store creation date and/or modification date for tables, > functions and other objects? No. -

Re: [SQL] index compatible date_trunc in postgres?

2008-12-19 Thread Alvaro Herrera
select count(*) from contexts where publication_date like > > '2006-09%'; > You can create an index on date_trunc (on timestamp without timezone, > but not on timestamp with timezone since it's not immutable) But you can create an index on the timestamptz AT TIME ZONE 'GM

Re: [SQL] How can this be legal syntax

2008-12-16 Thread Alvaro Herrera
emp table ...; (temp is a declared variable name). Nasty. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscript

Re: [SQL] [HACKERS] Reg: Nested query

2008-12-01 Thread Alvaro Herrera
on that recurses, or using such tricks as contrib/ltree. In the upcoming 8.4 version you will be able to write queries with the WITH RECURSIVE construct to handle this directly in SQL. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consu

Re: [SQL] JOIN results of refcursor functions

2008-11-30 Thread Alvaro Herrera
12 | tres por a (2 filas) I guess you should be able to do the same with cursor operations. I haven't see

Re: [SQL] JOIN results of refcursor functions

2008-11-27 Thread Alvaro Herrera
; > I would like yo avoid creating custom composite types required for setof. Then use OUT variables. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing l

Re: [SQL] Problem with delete trigger: how to allow only triggers to delete a row?

2008-10-10 Thread Alvaro Herrera
have to call a special function). Hmm, maybe you can turn a regular DELETE into a function call by using an INSTEAD rule, but I'm not sure. That way they would just do a plain DELETE and the sec-def function would be called instead. -- Alvaro Herrerahtt

Re: [SQL] Problem with delete trigger: how to allow only triggers to delete a row?

2008-10-10 Thread Alvaro Herrera
you should revoke DELETE privilege from plain users, and have your delete trigger be a security definer function. There would be another security definer function to delete non-deduced rows which users can call directly. -- Alvaro Herrerahttp://www.Comm

Re: [SQL] Function Syntax involving pipes and ' marks?

2008-09-09 Thread Alvaro Herrera
a$ and m.jb_date >='$a$ ||p_date|| $a$'$a$; or (harder to read) v_where varchar(256) := $a$ where m.jb_date < $a$||p_date + integer '1'|| $a$ and m.jb_date >=$b$ $a$ ||p_date|| $a$ $b$ $a$; -- Alvaro Herrera

Re: [SQL] DELETE with JOIN

2008-08-07 Thread Alvaro Herrera
cle, and it complained > of too much transactional data; I forget the exact wording now. I suggest you do not assume that Oracle implementation details apply to Postgres, because they do not, most of the time. They certainly don't in this case. -- Alvaro Herrera

Re: [SQL] Single Quote in tsquery

2008-08-06 Thread Alvaro Herrera
esult is just a coincidence. I think the tsearch grammar supports something it calls "simplified regular expressions" or some such, which includes character classes (delimited by brackets). So it would seem that what you show is actually supported and correct. -- Alvaro Herrera

Re: [SQL] Query prepared plan

2008-07-28 Thread Alvaro Herrera
Emi Lu wrote: > Similar to \dt to show all tables, within one session, may I know the > command to list all prepared query plan please? select * from pg_prepared_statements; -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command

Re: [SQL] Size or efficiency differences "varchar(128) vs. varchar(32)"

2008-07-21 Thread Alvaro Herrera
Emi Lu wrote: > May I know does varchar(128) and varchar(32) will cause any size or > efficiency differences? None at all. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via

Re: [SQL] pg_advisory_lock(bigint) vs. LOCK TABLE

2008-07-18 Thread Alvaro Herrera
Mark Roberts wrote: > > On Thu, 2008-07-17 at 12:16 -0400, Alvaro Herrera wrote: > > Volkan YAZICI wrote: > > > Hi, > > > > > > What's the difference between below two queue implementations? > > > > They are two different lock spaces. pg

Re: [SQL] pg_advisory_lock(bigint) vs. LOCK TABLE

2008-07-17 Thread Alvaro Herrera
Volkan YAZICI wrote: > Hi, > > What's the difference between below two queue implementations? They are two different lock spaces. pg_advisory_lock does not conflict with regular system locks, whereas LOCK TABLE does. -- Alvaro Herrera

Re: [SQL] Rollback in Postgres

2008-07-14 Thread Alvaro Herrera
from undo so there is no ADDITIONAL overhead. It > just saves the undo that is created anyway for any DML anyway. That > undo is already on disk. Which means it doesn't work for us, because we don't have UNDO (we only have REDO). -- Alvaro Herrera

Re: [SQL] Rollback in Postgres

2008-07-14 Thread Alvaro Herrera
ost people I've seen for which "it would come in handy" wouldn't have enabled it. (FWIW this feature used to exist in the Berkeley code, under the cool name "time travel", and was removed a long time ago.) -- Alvaro Herrerahttp://www

Re: [SQL] Re: Best practice for long-lived journal tables: bigint or recycling IDs?

2008-07-08 Thread Alvaro Herrera
Mark Stosberg wrote: > On Tue, 8 Jul 2008 17:20:13 -0400 > Alvaro Herrera <[EMAIL PROTECTED]> wrote: > > > 3. Deal with wraparound by ensuring that the applications behave sanely > > Wrap-around? > > Exceeding the max size of "int" looks more

Re: [SQL] Best practice for long-lived journal tables: bigint or recycling IDs?

2008-07-08 Thread Alvaro Herrera
be incremented past the max value of the "int" type in the normal course > of things. > > I see two options to prepare for that: 3. Deal with wraparound by ensuring that the applications behave sanely -- Alvaro Herrerahttp://www.CommandPro

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Alvaro Herrera
lation THEN CONTINUE; Try something like this: for a in select * from xxx loop begin insert into yyy values (...) exception when unique_violation then null; -- noop, just for clarity end; end loop; -- Alvaro Herrerahttp://www.CommandPrompt.com/ P

Re: [SQL] Auto-formatting timestamps?

2008-05-14 Thread Alvaro Herrera
Trying to create a view for all the tables with timestamps (and > creating appropriate rules for updating views) would be a huge > administrative PITA. If you're really set about that, you can add a new DateStyle setting. It's a bit of C hacking. (Or you can hir

Re: [SQL] psql: no schema info

2008-04-28 Thread Alvaro Herrera
h_path to '$user'; SET alvherre=# \d new_s.table1 Tabla «new_s.table1» Columna | Tipo | Modificadores -+-+- col1| integer | default nextval('old_s.seq1'::regclass)

Re: [SQL] extracting words

2008-04-23 Thread Alvaro Herrera
s > 3 soups > 3 french > 3 onion > 3 soup regexp_split_to_table is handy (8.3 only): select pk, regexp_split_to_table(product_name, '[& ]+') from products union select pk, regexp_split_to_table(dept_name, '[& ]+') from departments; Add joins as desired. --

Re: [SQL] Desc Commnad in pgsql?

2008-04-21 Thread Alvaro Herrera
ueries it used to build the response tables. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your s

Re: [DOCS] [HACKERS] [SQL] pl/PgSQL, variable names in NEW

2008-04-10 Thread Alvaro Herrera
ges things entirely. > +1 for just dropping the mention. Done. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to you

Re: [SQL] pl/PgSQL, variable names in NEW

2008-04-10 Thread Alvaro Herrera
on't know why we have a mention of DBD::PgSPI on the plperl manual at all. Is there anything it can do that can't be done with PL/Perl native calls? Question for plperl hackers: Should we remove the mention of DBD::PgSPI from the PL/Perl manual? -- Alvaro Herrera

Re: [SQL] Pattern Matchig

2008-04-08 Thread Alvaro Herrera
Tk421 escribió: >The result is only record number 3. How can i search the entire > FOOBAR word? The result wanted must be all, excepting 5. Something like this: select code from table where text ~ '[[:<:]]foobar[[:>:]]' -- Alvaro Herrera

Re: [SQL] pl/PgSQL, variable names in NEW

2008-04-08 Thread Alvaro Herrera
Martin Edlman wrote: > I don't want to rewrite whole trigger to plPerl as I would have to use > DBD-PgSPI. Huh? Certainly not -- there are functions in PL/Perl for this. See spi_exec_query in http://www.postgresql.org/docs/8.3/static/plperl-database.html -- Alv

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Alvaro Herrera
If you want to use the SQL window you could use SAVEPOINT and ROLLBACK TO. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)-

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Alvaro Herrera
Ken Johanson wrote: > Here's one Mysql developer's response to adding (fixing) the > integer/bigint/tinyint types to their CAST function: > > http://bugs.mysql.com/bug.php?id=34562 So they are anal too, but in the opposite direction? -- Alvaro Herrera

Re: [SQL] Usage of UUID with 8.3 (Windows)

2008-02-11 Thread Alvaro Herrera
ator, so the best bet would be to make that work. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 5: don't forget t

Re: [SQL] transaction and triggers

2008-01-18 Thread Alvaro Herrera
process -- the transaction only does a NOTIFY, which is certain to be delivered only when the transaction commits. So if it aborts, no spurious write occurs. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development

Re: [SQL] trigger for TRUNCATE?

2008-01-10 Thread Alvaro Herrera
Tom Lane escribió: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Gerardo Herzig escribi�: > >> Yes, the TRUNCATE statement is not sql ansi, maybe is a more low level > >> thing than i think. > > > TRUNCATE currently does not fire triggers, but that

Re: [SQL] trigger for TRUNCATE?

2008-01-10 Thread Alvaro Herrera
rrently, Mammoth Replicator does replicate TRUNCATE commands. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 4: Have you searched o

Re: [SQL] Foreign Key for multi PK or design question

2007-12-11 Thread Alvaro Herrera
seems sane, however you have forgotten to add NOT NULL to the FK fields. -- Alvaro Herrera http://www.PlanetPostgreSQL.org/ "No me acuerdo, pero no es cierto. No es cierto, y si fuera cierto, no me acuerdo." (Augusto Pinochet a una corte de justici

Re: [SQL] SQL INSERT/TRIGGER Help

2007-12-10 Thread Alvaro Herrera
erated number ( i.e. a serial field)? It's not a regex. I assume you are confused because it says "regclass". This is shorthand for "registered class" (where "class" is a synonymous for "relation", in this case a sequence). -- Alvaro Herrera

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Alvaro Herrera
that you store _in memory_ the number of planets added during the FOR EACH ROW trigger, and when that's done, call the FOR EACH STATEMENT trigger that does a single update adding the number in memory. This would work only if the FOR EACH STATEMENT trigger was promised to be executed after al

Re: [SQL] Strang behaviour SELECT ... LIMIT n FOR UPDATE

2007-11-28 Thread Alvaro Herrera
x seem to be corrupted. It has had ups and downs because I have my doubts about their storage system, but I'm not completely sure that it can be really blamed. This is on 8.1.10. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4" M

Re: [SQL] Select in From clause

2007-11-09 Thread Alvaro Herrera
er operated upon by the outer select. It is not expanded into a table name. One way to construct queries is to build plpgsql functions and use EXECUTE. However, the approach you are using looks like bad practice (read: bad database design). -- Alvaro Herrerahttp:

Re: [HACKERS] [SQL] Why does the sequence skip a number with generate_series?

2007-10-04 Thread Alvaro Herrera
ack. > I wouldn't count it as a bug but it could be regarded as undesirable side > effects. Don't use set-returning functions in "scalar context". If you put them in the FROM clause, as Stephan says above, it works fine. Anywhere else they have strange behavior and

Re: [SQL] Extracting hostname from URI column

2007-09-12 Thread Alvaro Herrera
Expressions - which I'm assuming is > dealing with this, so it's looking clearer. A very good resource on regular expressions is "Mastering Regular Expressions" by Jeffrey Friedl, now in its third edition: http://www.oreilly.com/catalog/regex3/ I read the first ed. years

Re: [SQL] postgresql HEAD build failure

2007-09-09 Thread Alvaro Herrera
John Summerfield wrote: > Alvaro Herrera wrote: >> Hmm, try deleting the build tree and start again. Sometimes, what >> happens to me is that somebody adds a new directory, and my build tree >> does not contain it. It's easy to fix: when I had a slower computer &g

Re: [SQL] postgresql HEAD build failure

2007-09-09 Thread Alvaro Herrera
I had a slower computer what I did was create the offending directory and symlink the makefile. Nowadays I just wipe the whole thing and let the build directory be constructed again by configure. That gets things in sync. Now that I look closer, however, this was always with source dirs, not

Re: [SQL] Incomprehensible dogged sort in Merge Join

2007-08-31 Thread Alvaro Herrera
8.0.1, not so old, IMHO. It _is_ quite old, yes. Try 8.2 at the very least, but in some cases you're going to get "current CVS HEAD does it better", so if you want to suggest improvements to the planner you should be really looking into that. -- Alvaro Herrera

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Alvaro Herrera
robably makes more > sense if you use plpgsql but I still don't quite see what the use case is. 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. -- Alvaro Herrera Val

Re: [SQL] Starting autovacuum in postgresql-8.1.9

2007-08-16 Thread Alvaro Herrera
u can simply uncomment and turn it on. Note that you will need to enable stats_row_level too. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)

Re: [SQL] Vacation days

2007-06-26 Thread Alvaro Herrera
t week off? > > > > > > Thanks! > > > > > > Wei > > hi, susan, a change of plan. :) > > Instead of the whole week, I just wanted to take next monday and tuesday off. -- Alvaro Herrerahtt

Re: [SQL] FATAL: cache lookup failed for function 1003

2007-05-23 Thread Alvaro Herrera
John Summerfield wrote: > Alvaro Herrera wrote: > >John Summerfield wrote: > > > >>Is this the right list for this? I'm off the 'net atm and can't easily > >>check. > >> > >>I'm running on self-built RHEL 4. > >> &g

Re: [SQL] FATAL: cache lookup failed for function 1003

2007-05-23 Thread Alvaro Herrera
w anything helpful to me. > The initdb command (sans --auth) works for psql (PostgreSQL) 7.4.6 so > I'm guessing I'm close. > > What might be the problem? Try doing a "make distclean" and recompile. -- Alvaro Herrerahttp://www.advogato.org/p

Re: [SQL] Query Join Performance

2007-04-25 Thread Alvaro Herrera
nalyze nightly - it is low usage and won't > cause any problems. It should have done an analyze at some point. Unless this is Windows, in which case there's a bug that precludes autovacuum from running at all. -- Alvaro Herrerahttp://www.CommandPromp

Re: [SQL] auto vacuuming

2007-04-05 Thread Alvaro Herrera
Sumeet escribió: > Then do i need to still provide the auto vacumming options in the > postgres.conf file or these options are automatically taken care of. You have to enable the autovacuum setting in postgresql.conf. It is not enabled by default. -- Alvaro H

Re: [SQL] auto vacuuming

2007-04-05 Thread Alvaro Herrera
tovacuum is now integrated into the core. So the way to find if it's installed is "yes". -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- T

Re: [SQL] Subqueryes

2007-03-22 Thread Alvaro Herrera
(but is not working): > > update myTable > set date = (current_date + (Select daysToAdd from base.Table1 where > myFKey_id = Table1Id) ) > where Expire_Date = now()::Date; So what is the error message? -- Alvaro Herrerahttp://www.CommandPrompt.

Re: [SQL] unsubscribe

2007-03-20 Thread Alvaro Herrera
member Bruce complaining about this not long ago (and threatening with Mailman!?) -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 9:

Re: [SQL] INSERT INTO

2007-03-16 Thread Alvaro Herrera
Shavonne Marietta Wijesinghe wrote: > Thanks alot What happens if you try to insert a string with $$ on it? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end

Re: [SQL] import CSV file

2007-03-13 Thread Alvaro Herrera
ctory > > The file exists. Do I need to escape the quotes? Is the server on the same machine that's running psql? If not, then this fails because it tries to open the file server-side. The suggested workaround is to use psql's \copy. -- Alvaro Herrera

Re: [SQL] For loop

2007-03-13 Thread Alvaro Herrera
(1, 100) a; I don't claim this works as is, but you should get the hang of it. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)---

Re: [SQL] For loop

2007-03-13 Thread Alvaro Herrera
, which I'd think is smarter anyway). If what you need to do is batch processing of rows to produce other rows, then maybe you can craft an INSERT .. SELECT query to do it instead of this row-at-a-time approach. -- Alvaro Herrerahttp://www.CommandPrompt.com

Re: [SQL] For loop

2007-03-13 Thread Alvaro Herrera
Ezequias R. da Rocha wrote: > They are not working well. > > Allways the same error. > > (if while) > ERROR: syntax error at or near "WHILE" > SQL state: 42601 > Character: 1 You may have a problem in the code just _before_ these lines. -- Alvaro Herrera

Re: [SQL] A form of inheritance with PostgreSQL

2007-03-12 Thread Alvaro Herrera
Greg Toombs wrote: > What disaster do you foresee? Is that version unstable? Yes. There are known, unfixed bugs, and architectural problems that cannot be fixed. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt,

Re: [SQL] Uppercase and Lowercase

2007-02-19 Thread Alvaro Herrera
Shavonne Marietta Wijesinghe wrote: > Hey thanks Bart. it worked ;) > > but sadly what it does is changes "VIA SENATO" in to "Via senato" but what i > need is "Via Senato" > > Anyoneee?? initcap() does what you want. -- Al

Re: [SQL] There is a different cast than ::MyOtherType() ?

2007-02-16 Thread Alvaro Herrera
Ezequias Rodrigues da Rocha escribió: > Hi list, > > My Delphi app does not suport this kind of cast: > > Select id, desc::Varchar(50) from myTable Try select id, cast(desc as varchar(50)) from yourTable -- Alvaro Herrerahttp://www.Co

Re: [SQL] Retrieving 'Credit' when 'C'

2007-02-15 Thread Alvaro Herrera
Ezequias Rodrigues da Rocha escribió: > Hello, > > Does anyone know how to make a Select that even having a Char(1) with the > letter C the statement makes the rows appearing 'CREDIT' ? case when column = 'C' then 'CREDIT' end -- Alvaro H

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Alvaro Herrera
st is best avoided: if you optimize for dumb users, the smart users then want you buried because you've lost performance doing useless work. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom

Re: [SQL] COPY FROM - force a value

2007-02-08 Thread Alvaro Herrera
ROM call excluding those columns, then removing the DEFAULT. If you do it in a transaction block, no other transaction can be molested by the default values, though they will be blocked of the table during that transaction. -- Alvaro Herrerahttp://www.CommandPrompt.com

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Alvaro Herrera
c("CREATE TABLE foo (t text);", 0); SPI_exec("CREATE INDEX foo_idx ON foo (lower(t))", 0); ? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Compilation Error AIX

2007-02-06 Thread Alvaro Herrera
s -Wpointer-arith -Winline > -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing > -I../../../src/include -c -o dynloader.o dynloader.c Where does the src/backend/port/dynloader.c symlink point to? What AIX version is this? GCC version? -- Alvaro Herrera

Re: [SQL] Evaluate a variable

2007-01-26 Thread Alvaro Herrera
Luís Sousa wrote: > Hi, > > Is there anyway to evaluate a variable in plpgsql, like eval on PHP? > Suppose the example: > > my_var:=''some value!''; > a:=''my_var''; > b:= a; > > I already tried b:=EXECUTE a

Re: [SQL] Droping indexes

2007-01-16 Thread Alvaro Herrera
ept only on one place (for example, the eventackuser could probably be put on a separate table and on this one store just an integer ID). This will make the table and the index on that column a lot smaller. 3. add more disks to your installation 4. research a more effective VACUUM

Re: [SQL] Finding gaps in scheduled events

2006-12-12 Thread Alvaro Herrera
Marcin Stępnicki wrote: > Now I need to create a query to find hours at which each of the type can > start. So, if it's event A (which take 15 minutes) it can start at: > > 8:00 (to 8:15) > 8:15 (to 8:30) > ( 8:30 to 8:45 is already taken ) > 8:45 (to 9:00) > 9:00 (to 9:15) > 9:15 (to 9:30) > ( 9

Re: [SQL] Select (1-3)

2006-11-30 Thread Alvaro Herrera
Ezequias Rodrigues da Rocha wrote: > Hi list, > > It is possible to make a selection like > > Select (list 1 to 1000); Sure, use the generate_series() function. select * from generate_series(1, 1000); -- Alvaro Herrerahttp://www.CommandPrompt.

Re: [SQL] Autovaccum

2006-11-30 Thread Alvaro Herrera
m time to time anyway, even if you don't delete anything. The easiest way to do it is let autovacuum do it for you. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)---

Re: [SQL] psql -F

2006-11-16 Thread Alvaro Herrera
with the -F option? This is really a shell question. On those I know, you'd type ^V . (Maybe it would work to use '\t' as well, not sure if psql interprets that.) -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom De

Re: [SQL] record datatype comparisons

2006-10-31 Thread Alvaro Herrera
select row(1,2) is distinct from row(1,2) ; ?column? -- f (1 fila) Is that what you're after? -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)-

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

2006-10-21 Thread Alvaro Herrera
But of course, that begs the question: Why on earth would you want to!!??? > > Cost? > > Extensibility? > > The feeling that you won't at any moment be greeted by men in dark suits > wanting to audit your facilities? > > Using Open Source is cool? Maybe

  1   2   >