Column shipped_at dropped. SQLSTATE[42501]: Insufficient privilege: 7 ERROR: must be owner of relation orders (Connection: pgsql, SQL: alter table "orders" drop column "shipped_at") (500 Internal Server Error)

Symfony Exception

PDOException QueryException

HTTP 500 Internal Server Error

SQLSTATE[42501]: Insufficient privilege: 7 ERROR: must be owner of relation orders (Connection: pgsql, SQL: alter table "orders" drop column "shipped_at")

Exceptions 2

Illuminate\Database\ QueryException

Show exception properties
Illuminate\Database\QueryException {#27
  +errorInfo: array:3 [
    0 => "42501"
    1 => 7
    2 => "ERROR:  must be owner of relation orders"
  ]
  +connectionName: "pgsql"
  #sql: "alter table "orders" drop column "shipped_at""
  #bindings: []
}
  1. throw new UniqueConstraintViolationException(
  2. $this->getName(), $query, $this->prepareBindings($bindings), $e
  3. );
  4. }
  5. throw new QueryException(
  6. $this->getName(), $query, $this->prepareBindings($bindings), $e
  7. );
  8. }
  9. }
  1. // Here we will run this query. If an exception occurs we'll determine if it was
  2. // caused by a connection that has been lost. If that is the cause, we'll try
  3. // to re-establish connection and re-run the query with a fresh connection.
  4. try {
  5. $result = $this->runQueryCallback($query, $bindings, $callback);
  6. } catch (QueryException $e) {
  7. $result = $this->handleQueryException(
  8. $e, $query, $bindings, $callback
  9. );
  10. }
  1. * @param array $bindings
  2. * @return bool
  3. */
  4. public function statement($query, $bindings = [])
  5. {
  6. return $this->run($query, $bindings, function ($query, $bindings) {
  7. if ($this->pretending()) {
  8. return true;
  9. }
  10. $statement = $this->getPdo()->prepare($query);
  1. * @return void
  2. */
  3. public function build(Connection $connection, Grammar $grammar)
  4. {
  5. foreach ($this->toSql($connection, $grammar) as $statement) {
  6. $connection->statement($statement);
  7. }
  8. }
  9. /**
  10. * Get the raw SQL statements for the blueprint.
  1. * @param \Illuminate\Database\Schema\Blueprint $blueprint
  2. * @return void
  3. */
  4. protected function build(Blueprint $blueprint)
  5. {
  6. $blueprint->build($this->connection, $this->grammar);
  7. }
  8. /**
  9. * Create a new command set with a Closure.
  10. *
  1. * @param \Closure $callback
  2. * @return void
  3. */
  4. public function table($table, Closure $callback)
  5. {
  6. $this->build($this->createBlueprint($table, $callback));
  7. }
  8. /**
  9. * Create a new table on the schema.
  10. *
  1. if (! $instance) {
  2. throw new RuntimeException('A facade root has not been set.');
  3. }
  4. return $instance->$method(...$args);
  5. }
  6. }
Facade::__callStatic('table', array('orders', object(Closure))) in /home/vzizxmil/public_html/banyal-connect-api/scratch/drop_shipped_at_col.php (line 8)
  1. $app = require __DIR__ . '/../bootstrap/app.php';
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. Schema::table('orders', function (Blueprint $table) {
  5. if (Schema::hasColumn('orders', 'shipped_at')) {
  6. $table->dropColumn('shipped_at');
  7. echo "Column shipped_at dropped.\n";
  8. } else {
  9. echo "Column shipped_at does not exist.\n";

PDOException

SQLSTATE[42501]: Insufficient privilege: 7 ERROR: must be owner of relation orders

  1. $this->bindValues($statement, $this->prepareBindings($bindings));
  2. $this->recordsHaveBeenModified();
  3. return $statement->execute();
  4. });
  5. }
  6. /**
  7. * Run an SQL statement and get the number of rows affected.
  1. $this->bindValues($statement, $this->prepareBindings($bindings));
  2. $this->recordsHaveBeenModified();
  3. return $statement->execute();
  4. });
  5. }
  6. /**
  7. * Run an SQL statement and get the number of rows affected.
in /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php -> {closure:Illuminate\Database\Connection::statement():576} (line 816)
  1. {
  2. // To execute the statement, we'll simply call the callback, which will actually
  3. // run the SQL against the PDO connection. Then we can calculate the time it
  4. // took to execute and log the query SQL, bindings and time in our memory.
  5. try {
  6. return $callback($query, $bindings);
  7. }
  8. // If an exception occurs when attempting to run a query, we'll format the error
  9. // message to include the bindings with SQL, which will make this exception a
  10. // lot more helpful to the developer instead of just the database's errors.
  1. // Here we will run this query. If an exception occurs we'll determine if it was
  2. // caused by a connection that has been lost. If that is the cause, we'll try
  3. // to re-establish connection and re-run the query with a fresh connection.
  4. try {
  5. $result = $this->runQueryCallback($query, $bindings, $callback);
  6. } catch (QueryException $e) {
  7. $result = $this->handleQueryException(
  8. $e, $query, $bindings, $callback
  9. );
  10. }
  1. * @param array $bindings
  2. * @return bool
  3. */
  4. public function statement($query, $bindings = [])
  5. {
  6. return $this->run($query, $bindings, function ($query, $bindings) {
  7. if ($this->pretending()) {
  8. return true;
  9. }
  10. $statement = $this->getPdo()->prepare($query);
  1. * @return void
  2. */
  3. public function build(Connection $connection, Grammar $grammar)
  4. {
  5. foreach ($this->toSql($connection, $grammar) as $statement) {
  6. $connection->statement($statement);
  7. }
  8. }
  9. /**
  10. * Get the raw SQL statements for the blueprint.
  1. * @param \Illuminate\Database\Schema\Blueprint $blueprint
  2. * @return void
  3. */
  4. protected function build(Blueprint $blueprint)
  5. {
  6. $blueprint->build($this->connection, $this->grammar);
  7. }
  8. /**
  9. * Create a new command set with a Closure.
  10. *
  1. * @param \Closure $callback
  2. * @return void
  3. */
  4. public function table($table, Closure $callback)
  5. {
  6. $this->build($this->createBlueprint($table, $callback));
  7. }
  8. /**
  9. * Create a new table on the schema.
  10. *
  1. if (! $instance) {
  2. throw new RuntimeException('A facade root has not been set.');
  3. }
  4. return $instance->$method(...$args);
  5. }
  6. }
Facade::__callStatic('table', array('orders', object(Closure))) in /home/vzizxmil/public_html/banyal-connect-api/scratch/drop_shipped_at_col.php (line 8)
  1. $app = require __DIR__ . '/../bootstrap/app.php';
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. Schema::table('orders', function (Blueprint $table) {
  5. if (Schema::hasColumn('orders', 'shipped_at')) {
  6. $table->dropColumn('shipped_at');
  7. echo "Column shipped_at dropped.\n";
  8. } else {
  9. echo "Column shipped_at does not exist.\n";

Stack Traces 2

[2/2] QueryException
Illuminate\Database\QueryException:
SQLSTATE[42501]: Insufficient privilege: 7 ERROR:  must be owner of relation orders (Connection: pgsql, SQL: alter table "orders" drop column "shipped_at")

  at /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:829
  at Illuminate\Database\Connection->runQueryCallback('alter table "orders" drop column "shipped_at"', array(), object(Closure))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:783)
  at Illuminate\Database\Connection->run('alter table "orders" drop column "shipped_at"', array(), object(Closure))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:576)
  at Illuminate\Database\Connection->statement('alter table "orders" drop column "shipped_at"')
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Blueprint.php:110)
  at Illuminate\Database\Schema\Blueprint->build(object(PostgresConnection), object(PostgresGrammar))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:602)
  at Illuminate\Database\Schema\Builder->build(object(Blueprint))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:444)
  at Illuminate\Database\Schema\Builder->table('orders', object(Closure))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/support/Facades/Facade.php:355)
  at Illuminate\Support\Facades\Facade::__callStatic('table', array('orders', object(Closure)))
     (/home/vzizxmil/public_html/banyal-connect-api/scratch/drop_shipped_at_col.php:8)                
[1/2] PDOException
PDOException:
SQLSTATE[42501]: Insufficient privilege: 7 ERROR:  must be owner of relation orders

  at /home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:587
  at PDOStatement->execute()
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:587)
  at Illuminate\Database\Connection->{closure:Illuminate\Database\Connection::statement():576}('alter table "orders" drop column "shipped_at"', array())
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:816)
  at Illuminate\Database\Connection->runQueryCallback('alter table "orders" drop column "shipped_at"', array(), object(Closure))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:783)
  at Illuminate\Database\Connection->run('alter table "orders" drop column "shipped_at"', array(), object(Closure))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Connection.php:576)
  at Illuminate\Database\Connection->statement('alter table "orders" drop column "shipped_at"')
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Blueprint.php:110)
  at Illuminate\Database\Schema\Blueprint->build(object(PostgresConnection), object(PostgresGrammar))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:602)
  at Illuminate\Database\Schema\Builder->build(object(Blueprint))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/database/Schema/Builder.php:444)
  at Illuminate\Database\Schema\Builder->table('orders', object(Closure))
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/illuminate/support/Facades/Facade.php:355)
  at Illuminate\Support\Facades\Facade::__callStatic('table', array('orders', object(Closure)))
     (/home/vzizxmil/public_html/banyal-connect-api/scratch/drop_shipped_at_col.php:8)