Re: [SQL] Common table expression - parsing questions

2009-10-04 Thread the6campbells
the db2 family does not

On Sun, Oct 4, 2009 at 2:10 AM, Thomas Kellerer  wrote:

> the6campbells wrote on 29.09.2009 04:54:
>
>> 2. Do you intend to remove the requirement to include the recursive
>> keyword - as other vendors allow
>>
>
> The standard *requires* the keyword.
> As far as I can tell there are two DBMS that require it (Postgres,
> Firebird) and two that don't (SQL Server and Oracle with the newest release)
>
> Thomas
>
>
> --
> Sent via pgsql-sql mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


[SQL] reading last inserted record withoud any autoincrement field

2009-10-04 Thread mohammad qoreishy
How can get last inserted record in a table without any autoincrement filed?
I need to  frequently fetch the last inserted record.
If I must use the "Cursor" please explain your solution.



  

Re: [SQL] Common table expression - parsing questions

2009-10-04 Thread Tom Lane
Thomas Kellerer  writes:
> the6campbells wrote on 29.09.2009 04:54:
>> 2. Do you intend to remove the requirement to include the recursive 
>> keyword - as other vendors allow

> The standard *requires* the keyword. 

The reason the standard requires the keyword is that the WITH-name
scoping rules are different in the two cases.  This means it is possible
to construct 100% valid queries that mean different things depending on
whether RECURSIVE is present or not.  Admittedly, they'd be uncommon
corner cases, but the short answer is that an implementation that does
not require the keyword will fail to process some standard-conforming
queries in a standard-conforming way.

IOW, no, we are not going to change this.

regards, tom lane

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] reading last inserted record withoud any autoincrement field

2009-10-04 Thread Osvaldo Kussama
2009/10/4 mohammad qoreishy 
>
> How can get last inserted record in a table without any autoincrement filed?
> I need to  frequently fetch the last inserted record.
> If I must use the "Cursor" please explain your solution.
>


RETURNING clause?
http://www.postgresql.org/docs/current/interactive/sql-insert.html

Osvaldo

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] reading last inserted record withoud any autoincrement field

2009-10-04 Thread Rob Sargent

Osvaldo Kussama wrote:

2009/10/4 mohammad qoreishy 
  

How can get last inserted record in a table without any autoincrement filed?
I need to  frequently fetch the last inserted record.
If I must use the "Cursor" please explain your solution.





RETURNING clause?
http://www.postgresql.org/docs/current/interactive/sql-insert.html

Osvaldo

  
It took the OP to mean last insert as in randomly in the past, not as 
part of current transaction.  My fear is OP's schema has no way of 
identifying time-of-insert, nor a monotonically increasing record id and 
is hoping postgres has a some internal value that will return the most 
recently inserted record. Without a table definition it's hard to say.


--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql