laravel-oci8
laravel-oci8 copied to clipboard
Cannot use sequences not owned by DB user
Summary of problem or feature request
Hi, I cannot drop or get the current value of sequences that my user is not the owner of, even though my user has permission to create/nextval them. The sequence in question is in a schema not owned by my DB user. Is there some way I can disable the check when dropping/accessing sequences? Also, can the schema prefix be left out when querying for the sequence?
Code snippet of problem
DB::getSequence()->create('transaction_seq'); // Works
DB::enableQueryLog(); // Start of SQL logs below
$transaction_id = DB::getSequence()->currentValue('transaction_seq'); // Returns 0
$transaction_id = DB::getSequence()->nextValue('transaction_seq'); // Returns 1
$transaction_id = DB::getSequence()->currentValue('transaction_seq'); // Still returns 0
DB::getSequence()->drop('transaction_seq'); // Does not do anything
DB::getQueryLog();
-- Sequence name should NOT include the schema prefix "test", and my DB user is not the owner
select * from all_sequences where sequence_name=upper('test.transaction_seq') and sequence_owner=upper(user)
select test.transaction_seq.nextval as "id" from dual -- It's fine to use the schema prefix for this query though
select * from all_sequences where sequence_name=upper('test.transaction_seq') and sequence_owner=upper(user)
select * from all_sequences where sequence_name=upper('test.transaction_seq') and sequence_owner=upper(user)
System details
- Windows 10
- PHP 8.1.15
- Laravel 10.x
- Laravel-OCI8 v10.3.0