小编Ano*_*ith的帖子

Postgresql:无法访问文件«$ libdir/postgis-2.1»没有这样的文件或目录

我想这是一个已知的问题,但由于我使用的脚本删除了我的postgresql-9.4-postgis-2.1,我现在无法摆脱Debian下的这个SQL错误.

无法访问文件«$ libdir/postgis-2.1»没有这样的文件或目录

我做了以下事情:

- Remove new unwanted postgresql-9.5-postgis-2.2 package installed
- Reinstalling postgresql-9.4-postgis-2.1, postgresql-9.4-postgis-scripts and postgis
- Using SQL: ALTER EXTENSION postgis UPDATE TO '2.1.4' --under postgres user
- Using SQL: ALTER EXTENSION postgis_topology UPDATE TO '2.1.4' --under postgres user
Run Code Online (Sandbox Code Playgroud)

SELECT * FROM pg_available_extensions;返回

[...]
postgis 2.1.4   2.1.4   PostGIS geometry, geography, and raster spatial types and functions.
Run Code Online (Sandbox Code Playgroud)

但是在访问像使用几何类型的表这样的对象时仍然是这条消息.

任何的想法?

migration postgresql postgis

7
推荐指数
2
解决办法
9095
查看次数

Node-postgres:命名参数查询(nodejs)

出于实际原因,例如在使用PDO的php中,我经常在准备SQL查询时为参数命名。

那么我可以在node-postgres模块中使用命名参数吗?

现在,我在互联网上看到许多示例和文档,它们显示了如下查询:

client.query("SELECT * FROM foo WHERE id = $1 AND color = $2", [22, 'blue']);
Run Code Online (Sandbox Code Playgroud)

但这也正确吗?

client.query("SELECT * FROM foo WHERE id = :id AND color = :color", {id: 22, color: 'blue'});
Run Code Online (Sandbox Code Playgroud)

或这个

client.query("SELECT * FROM foo WHERE id = ? AND color = ?", [22, 'blue']);
Run Code Online (Sandbox Code Playgroud)

我问这个问题是因为$n在动态构建查询的情况下,带编号的参数对我没有帮助。

sql query-parameters node.js node-postgres

6
推荐指数
2
解决办法
5210
查看次数

Symfony 3主义2:关于关系的循环参考

我正在尝试使用Doctrine 2在Symfony 3中运行4个实体,但是当我想序列化一个Account实体时,我仍然坚持循环引用异常:

检测到循环引用(配置限制:1).

我在我的实体中选择了双向关系,架构是这样的:

 - Account [1] ---- [0..*] AccountSheet
 - AccountSheet [1] ---- [0..*] Operation
 - Operation [0..*] ---- [1] Category
Run Code Online (Sandbox Code Playgroud)

这是实体(为清晰起见,有一些清洁):

SRC \的appbundle \实体\ Account.php

<?php
    namespace AppBundle\Entity;

    use Doctrine\ORM\Mapping as ORM;
    use Doctrine\Common\Collections\ArrayCollection;
    use AppBundle\Entity\AbstractGenericEntity;

    /**
     * @ORM\Entity()
     * @ORM\Table(name="accounts",
     *      uniqueConstraints={@ORM\UniqueConstraint(name="accounts_name_unique",columns={"name"})})
     */
    class Account extends AbstractGenericEntity{
        /**
         * @ORM\OneToMany(targetEntity="AccountSheet", mappedBy="account")
         * @var AccountSheet[]
         */
        protected $accountSheets;

        public function __construct($name = null, $description = null){
            $this->accountSheets = new ArrayCollection();
            $this->name = $name;
            $this->description = $description;
        } …
Run Code Online (Sandbox Code Playgroud)

php doctrine circular-reference symfony

2
推荐指数
1
解决办法
5070
查看次数