It is a hack, but when someone wants you to do something in a way
different from the norm, aren't they asking for a hack?
SQL Server does something like
select top (1) from
I am thinking this is NOT a SQL-99 standard.
This was an interview with Amazon, and I don't think Amazon wanted a hac
select max(date_sent) from table;
would equal
select date_sent from broadcast_history order by date_sent DESC limit 1;
That sounds like a hack. Is limit a SQL-99 standard? Is there are
another way to do this?
Sorry to take over your topic, Collin.
Thanks,
Yasir
---(e
What I would like to do is simply get the last date_sent and it's
status for every broadcast. I can't do a GROUP BY because I can't put
an aggregate on the status column.
SELECT MAX(date_sent), status
FROM broadcast_history
GROUP BY broadcast_id
You could try the following:
select status
fro
Hello All,
I have been having a really hard time trying to come up with a pl/pgsql
recursive function to returns the end nodes of a tree.
Here is an example table definition:
CREATE TABLE parent_child (
parent_id integer NOT NULL,
child_id integer NOT NULL
);
INSERT INTO parent_child (parent_id
This isn't a PostgreSQL issue, but rather one of understanding how
regular expressions work in general. See the previously mentioned
"Pattern Matching" section of the PostgreSQL documentation for the
PostgreSQL-specific details, and use a search engine to find a
regular expression tutorial; they'
The current behavior is by design.
We use the table as a logging repository. It can get very large 250 000
records. Because of the large number of records that we have in the table we
found it was much faster to perform inserts on a smaller table. Our current
system rolls the tables over every 12
Hi,
I need to connect to 2 differents Postgres 8.0.0
databases located in the same machine using the same
PHP script with an "db wrapper object" instance
(pg_Connect)... simply a PHP page with contemporarily
2 database connections...
I don't think this is the right place to ask this, but there's an
beta_jgw=# update scenario1.time_test set local_hour = extract(hour from
to_timestamp(to_char(gmt_date,'-MM-DD')||'
'||to_char(gmt_hour,'99')||':00:00-00','-MM-DD HH24:MI:SS') at time zone
'EST');
Wild guess, but shouldn't that be :00:00:00?
Regards,
Yasir
1. How to migrate Procedures and Packages from Oracle to PostgreSQL
2. How to find error messages in PostgreSQL thrown from an Exception (as we
can get messages in Oracle with "SQLERRM" keyword)
for example --
--Raise an exception
RAISE EXCEPTION 'No Data found for record id % ' ,recordid
beta_jgw=# update scenario1.time_test set local_hour = extract(hour from
to_timestamp(to_char(gmt_date,'-MM-DD')||'
'||to_char(gmt_hour,'99')||':00:00-00','-MM-DD HH24:MI:SS') at time
zone 'EST');
This sounds like a stupid answer, but shouldn't that be :00:00:00?
CREATE TYPE qwerty_UDT AS (abc INT);
CREATE TABLE t (col1 qwerty_UDT);
INSERT INTO t (col1) VALUES (qwerty_UDT(123));
ERROR: function qwerty_udt(integer) does not exist
HINT: No function matches the given name and argument types. You may need to
add explicit type casts.
It seems as though you wa
for example
create function a_func() return integer as
.
end a_func
after as and before end a_func marks the definition body. Would this be
better than the ' '?
I guess having a parser that gave better error messages would be nice,
too.
Yasir
---(end of broadcast)
> Is it possible to create a database function that mimics the C function atof?
> I'm guessing it should look something like this:
You can do this to convert a string to a float:
select '3.14'::float + 1;
?column?
--
4.14
(1 row)
Is that what you want?
Yasir
--
> Good morning,afternoon, and evening Everyone,
>
> My research into PostgreSQL documentation has yet to yeild any information about
> PostgreSQL's support of ANSI SQL-99 syntax, and in particular, the "WITH" clause -
> which if I understand correctly, allows recursive joins in simple syntax with
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
> I need to write a function which has to replace a character with two or three other
> characters
>
You can use the replace function as specified below:
replace(string text, from text, to text) text
Replace all occurrences in @string of substr
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Yes you can. Try this:
(select string_A from main_table) union (select string_B from main_table)
Yasir
On Thu, 13 May 2004, [EMAIL PROTECTED] wrote:
> Date: Thu, 13 May 2004 04:07:08 -0400
> From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> To: [EMAI
ar(2), addr AddrType);
create table Cust of CustType;
Which is superior to Postgres's way of implementing types (writing a C
function).
Thanks,
Yasir
On Mon, 15 Mar 2004, John DeSoi wrote:
> Date: Mon, 15 Mar 2004 08:28:50 -0500
> From: John DeSoi <[EMAIL PROTECTED]>
>
Hello,
For my object-relational database class I decided to use PostgreSQL
because it is my favorite database and it calls it self a ORDBMS. Little
did I know that it supports supports very little OR features. For
example, using "create type as" is totally worthless because you can't use
it as a
Well, there's phpPgAdmin. It's available at
http://phppgadmin.sourceforge.net/
Yasir
On Mon, 8 Mar 2004 [EMAIL PROTECTED] wrote:
> Date: Mon, 8 Mar 2004 10:13:53 +0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [SQL] designer tool connect to PostgreSQL
>
> Hi,
>
> i use postgre
Hello,
I don't know why this message is not going through!
I have the following types:
create type street_type as
(
street_number smallint,
street_name text,
apt_number smallint
);
create type address_type as
(
street street_type,
citytext,
state char(2),
The antilog of x is 10^x, so all you need to do is used the ^ operator.
If you are doing the antilog for some other base, there is formula to do
that as well, but I'm forgetting it.
Regards,
Yasir
On Fri, 26 Dec 2003, Martin Marques wrote:
> Date: Fri, 26 Dec 2003 19:34:35 -0300
> From: Martin Ma
Guillaume,
Thank you very much for your response.
Yasir
On Sat, 15 Nov 2003, Guillaume LELARGE wrote:
> Date: Sat, 15 Nov 2003 17:41:41 +
> From: Guillaume LELARGE <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [SQL] Getting last insert value
>
> Le Samedi 15 Novembre 2003 16:40,
Hello,
Is there a way to do addition and subtraction on BIT types? For example,
for
creat table test (a BIT(3));
insert into test values (B'101');
select a + 1 from test; fails
and select a::smallint + 1 from test; also fails.
In addition, is there a way to change the bit of a bit string? For
Hello,
I don't think there's any reason you should use arrays. You can do
everything using tables, and it probably would be easier to use tables
instead. Extracting information from arrays is also more
difficult if you're using something like JDBC or the connectivity
available in PHP. I don't kn
Hello,
I don't think there's any reason you should use arrays. You can do
everything using tables, and it probably would be easier to use tables
instead. Extracting information from arrays is also more
difficult if you're using something like JDBC or the connectivity
available in PHP. I don't kn
l be doing a lot bit manipulation.
Thanks,
Yasir
On Sun, 16 Nov 2003, Stephan Szabo wrote:
> Date: Sun, 16 Nov 2003 21:40:45 -0800 (PST)
> From: Stephan Szabo <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [SQL] Addition and
l be doing a lot bit manipulation.
Thanks,
Yasir
On Sun, 16 Nov 2003, Stephan Szabo wrote:
> Date: Sun, 16 Nov 2003 21:40:45 -0800 (PST)
> From: Stephan Szabo <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [SQL] Addition and
ng message:
ERROR: parser: parse error at or near "int4" at character 12
Can anyone tell me why the bit function is not working? It's under the
pg_catalog schema.
Thanks,
Yasir
On Sun, 16 Nov 2003, Yasir Malik wrote:
> Date: Sun, 16 Nov 2003 11:18:03 -0500
> From: Yasir Malik &
Hello,
Is there a way to do addition and subtraction on BIT types? For example,
for
creat table test (a BIT(3));
insert into test values (B'101');
select a + 1 from test; fails
and select a::smallint + 1 from test; also fails.
In addition, is there a way to change the bit of a bit string? For
Thank you all for your help.
Yasir Malik
On Sat, 15 Nov 2003, Greg Stark wrote:
> Date: 15 Nov 2003 12:50:28 -0500
> From: Greg Stark <[EMAIL PROTECTED]>
> To: Guillaume LELARGE <[EMAIL PROTECTED]>
> Cc: Yasir Malik <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> Subje
inserted.
I know I can select the maximum value from the serial field, but is there
a better way, preferably something that takes constant time.
Thanks,
Yasir Malik
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http
Hello,
For a data warehousing project I will have to implement bitmaps. I would
perfer to stay away from C, Java, etc., and would like to use PostgreSQL
instead. I have a question about bit string type: does the time it takes
to do the & or | of two bit strings run in constant time (as it does i
Hi,
I'm usually wrong, but you can create a view for Query1 and Query2. That
is do
create view Query1 [your query for query1];
create view Query2 [your query for query2];
Then what you are doing should work.
Regards,
Yasir
On Sat, 8 Nov 2003, [iso-8859-1] ron_tabada wrote:
> Date: Sat, 8 Nov 20
That's what I said! :)
Yasir
On Sun, 9 Nov 2003, Christopher Browne wrote:
> Date: Sun, 09 Nov 2003 21:59:14 -0500
> From: Christopher Browne <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [SQL] help me...
>
> The world rejoiced as [EMAIL PROTECTED] (ron_tabada) wrote:
> > Hello every
Hi,
I'm usually wrong, but you can create a view for Query1 and Query2. That
is do
create view Query1 [your query for query1];
create view Query2 [your query for query2];
Then what you are doing should work. Are views offered in Access?
Regards,
Yasir
On Sat, 8 Nov 2003, [iso-8859-1] ron_tabada
Hi,
You can use the age() function to find the difference between dates, and
use the extract() function to get the years, months, days, etc.
Yasir
On Fri, 7 Nov 2003, George A.J wrote:
> Date: Fri, 7 Nov 2003 05:34:09 -0800 (PST)
> From: George A.J <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Su
Hi,
You can use the age() function to find the difference between dates, and
use the extract() function to get the years, months, days, etc.
Yasir
On Fri, 7 Nov 2003, George A.J wrote:
> Date: Fri, 7 Nov 2003 05:34:09 -0800 (PST)
> From: George A.J <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Su
Thank god that I use Pine.
Yasir
On Fri, 19 Sep 2003, Paul Thomas wrote:
> Date: Fri, 19 Sep 2003 23:14:54 +0100
> From: Paul Thomas <[EMAIL PROTECTED]>
> To: "pgsql-sql @ postgresql . org" <[EMAIL PROTECTED]>
> Subject: Re: [SQL] virus warning
>
> On 19/09/2003 16:37 scott.marlowe wrote:
> >
> >
I will surely use your suggestion in my future programs.
Thanks,
Yasir
On Wed, 9 Jul 2003, Dmitry Tkach wrote:
> Date: Wed, 09 Jul 2003 18:51:48 -0400
> From: Dmitry Tkach <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re
ach wrote:
> Date: Wed, 09 Jul 2003 18:40:37 -0400
> From: Dmitry Tkach <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [SQL] Datatype conversion help
>
> What about lpad?
>
> select lpad (7, 2, 0) || '-
Mr. Haller
That was what I was exactly looking for. The guys at
experts-exchange.com or any other website could come up with that answer.
I figured it out without using DISTINCT ON, but the solution was
horrendous. I have already turned in my assignment, however. Thank you so
much for your help.
re playing with, simply use:
>
> to_char( , 'MM-DD-' )
>
> to get what you want.
>
> --
> David Olbersen
> iGuard Engineer
> St. Bernard Software
> 11415 West Bernardo Court
> San Diego, CA 92127
> 1-858-676-2277 x2152
>
instead of what I want:
07-25-1994
Thanks,
Yasir
On Tue, 8 Jul 2003, Richard Rowell wrote:
> Date: 08 Jul 2003 15:21:33 -0500
> From: Richard Rowell <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Subject: Re: [SQL] Datatype conversion help
>
> On Tue, 2
Suppose I have an integer between 0 and 99 and I want to covert it to
string, and pad leading zeros if neccessary. For example,
1 => 01
10 => 10
I've tried to_char(in_val, '99'), and that returns a string that is two
charecters, but there isn't a leading zero incase I have the number 2 as
input.
Suppose I have a relation called sales with the following schema:
sales-Schema = (cust, prod, mn, dy, yr, quant, st)
An instance of the relation would look something like this:
custprodmn dy yr quant st
== == == = ==
Knuth Milk02
45 matches
Mail list logo