问题标签 [postgresql-9.1]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
postgresql - Simple stored procedure-like function in PostgreSQL?
I want to create a function in pgsql that will take three parameters and return a single value (1 row, 1 col).
I have the query working but can not seem to find a proper example of creating a function to do this.
postgresql - Slony 和 PGPool 用于故障转移
我们正在考虑将 Slony 和 PGPool 作为在我们的应用程序中处理故障转移的替代方案——看起来因为我们至少需要两个数据库服务器,所以我们也可以利用负载平衡——
在什么情况下 Slony 比 PGPool 好,反之亦然?
postgresql - 如何退出 PostgreSQL 命令行实用程序:psql
我可以使用什么命令或快捷键来退出 PostgreSQL 命令行实用程序psql
?
postgresql-9.1 - postgresql中十进制和数字数据类型有什么区别
postgresql 中的十进制数据类型和数字数据类型有什么区别?我在手册中没有发现任何区别。
ejb-3.0 - Postgres + EJB3 预分配大小错误
我在 postgres 和 jpa 中的序列有问题
sql - 查询特定 id 时按顺序查找上一行/下一行
我有一张表格,例如(简化到极致以使其更清晰)
每次从数据库中获取一行时,我都会尝试获取下一个和上一个元素的 ID,以允许导航。这些行不是按 id 排序的,而是按ORDER BY order_field_1 DESC, order_field_2 DESC
.
在获取所有者的最后一个条目时,我可以毫无问题地使用窗口和领先/滞后找到我想要的东西
这是从记忆中写出来的,但这就是它的要点,它工作得很好。
My problem is when I want to get a specific row, using owner AND id, yet I still want to find the previous and next ids, I can not use a window function anymore since only one row is returned by the where, and my current solution of doing a subquery to get both navigation id is not very good performance wise
For exemple (I only put previous id since it's the same for next)
So I'm selecting my row, then selection the first row from the same user, with a different id, that is either with a lower order_field_1 or the same but a lower order_field_2.
This is not really efficient and I am getting poor performances, and I'm wondering if anyone has any idea on how I could improve it ?
Exemple dataset:
Ordered:
If I select owner = 'someuser' and id = 3, previous_id should be 1, next_id should be 6.
If I select owner = 'someuser' and id = 1, previous_id should be 4, next_id should be 3.
Thanks in advance for any help
postgresql - 从流复制中排除数据库
是否可以在 Pg 9.1 中从流复制中排除特定数据库?
假设我定义了两个数据库 A 和 B,目标是忽略备份服务器上与数据库 B 相关的所有内容。
感谢您的提示!
postgresql-9.1 - PostgreSQL强制小写名称?
刚开始通过C和libpq在linux上学习PostgreSQL 9.1。
现在我检查连接、连接、创建数据库、创建表和其他基本的东西。但我注意到,在创建表期间,PQ 会将我的数据库名称转换为小写。然后我看到表名和字段名也被强制小写。但是,当我尝试连接数据库的大写(原始)名称时,我收到警告,询问数据库不存在。
最重要的是所有名称都保持原样。这可以通过一些简单的方法/设置来实现吗?
例如:
M_122_KL0001_2011_001_0100001
将被创建为 m_122_kl0001_2011_001_0100001 我不需要的东西。
表名和字段名也是如此。
c - PostgreSQL,使用 libpq 插入浮点数
我在 C 中创建了带有混合数据的插入字符串,并且无法插入行。
如我所见,问题可能出在我的语言环境中使用逗号作为小数分隔符的浮点数中。
所以,插入时我收到错误消息:
错误:INSERT 的表达式多于目标列
第 1 行:...0:11:37.097203 +0100'、'关于解决问题的书'、''、'PCS'、0,000000)
插入代码:
如何解决这种情况以正确插入双精度数字?
ruby-on-rails - Rails 3 - 无法安装 pg gem
当我尝试运行捆绑(捆绑安装)时,我总是得到
我使用 Mac OS X 10.6,安装的 PostgreSQL 版本是 9.1。我发现问题出在libpq-dev中,我该如何安装/修复它?